当前位置: 首页>>代码示例>>PHP>>正文


PHP XoopsMediaUploader::getMediaName方法代码示例

本文整理汇总了PHP中XoopsMediaUploader::getMediaName方法的典型用法代码示例。如果您正苦于以下问题:PHP XoopsMediaUploader::getMediaName方法的具体用法?PHP XoopsMediaUploader::getMediaName怎么用?PHP XoopsMediaUploader::getMediaName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XoopsMediaUploader的用法示例。


在下文中一共展示了XoopsMediaUploader::getMediaName方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: publisher_pagewrap_upload

/**
 * @param $errors
 *
 * @return bool
 */
function publisher_pagewrap_upload(&$errors)
{
    //    include_once PUBLISHER_ROOT_PATH . '/class/uploader.php';
    xoops_load('XoopsMediaUploader');
    $publisher =& PublisherPublisher::getInstance();
    $postField = 'fileupload';
    $maxFileSize = $publisher->getConfig('maximum_filesize');
    $maxImageWidth = $publisher->getConfig('maximum_image_width');
    $maxImageHeight = $publisher->getConfig('maximum_image_height');
    if (!is_dir(publisherGetUploadDir(true, 'content'))) {
        mkdir(publisherGetUploadDir(true, 'content'), 0757);
    }
    $allowedMimeTypes = array('text/html', 'text/plain', 'application/xhtml+xml');
    $uploader = new XoopsMediaUploader(publisherGetUploadDir(true, 'content') . '/', $allowedMimeTypes, $maxFileSize, $maxImageWidth, $maxImageHeight);
    if ($uploader->fetchMedia($postField)) {
        $uploader->setTargetFileName($uploader->getMediaName());
        if ($uploader->upload()) {
            return true;
        } else {
            $errors = array_merge($errors, $uploader->getErrors(false));
            return false;
        }
    } else {
        $errors = array_merge($errors, $uploader->getErrors(false));
        return false;
    }
}
开发者ID:trabisdementia,项目名称:publisher,代码行数:32,代码来源:pw_upload_file.php

示例2: publisher_pagewrap_upload

function publisher_pagewrap_upload(&$errors)
{
    $publisher = Publisher::getInstance();
    $post_field = 'fileupload';
    $max_size = $publisher->getConfig('maximum_filesize');
    $max_imgwidth = $publisher->getConfig('maximum_image_width');
    $max_imgheight = $publisher->getConfig('maximum_image_height');
    if (!is_dir(PublisherUtils::getUploadDir(true, 'content'))) {
        mkdir(PublisherUtils::getUploadDir(true, 'content'), 0757);
    }
    $allowed_mimetypes = array('text/html', 'text/plain', 'application/xhtml+xml');
    $uploader = new XoopsMediaUploader(PublisherUtils::getUploadDir(true, 'content') . '/', $allowed_mimetypes, $max_size, $max_imgwidth, $max_imgheight);
    if ($uploader->fetchMedia($post_field)) {
        $uploader->setTargetFileName($uploader->getMediaName());
        if ($uploader->upload()) {
            return true;
        } else {
            $errors = array_merge($errors, $uploader->getErrors(false));
            return false;
        }
    } else {
        $errors = array_merge($errors, $uploader->getErrors(false));
        return false;
    }
}
开发者ID:mambax7,项目名称:publisher-26,代码行数:25,代码来源:pw_upload_file.php

示例3: storeUpload

 function storeUpload($post_field, $response = null, $allowed_mimetypes = null)
 {
     //global $xoopsModuleConfig, $xoopsUser, $xoopsDB, $xoopsModule;
     include_once XHELP_CLASS_PATH . '/uploader.php';
     $config =& xhelpGetModuleConfig();
     $ticketid = $this->getVar('id');
     if (!isset($allowed_mimetypes)) {
         $hMime =& xhelpGetHandler('mimetype');
         $allowed_mimetypes = $hMime->checkMimeTypes();
         if (!$allowed_mimetypes) {
             return false;
         }
     }
     $maxfilesize = $config['xhelp_uploadSize'];
     $maxfilewidth = $config['xhelp_uploadWidth'];
     $maxfileheight = $config['xhelp_uploadHeight'];
     if (!is_dir(XHELP_UPLOAD_PATH)) {
         mkdir(XHELP_UPLOAD_PATH, 0757);
     }
     $uploader = new XoopsMediaUploader(XHELP_UPLOAD_PATH . '/', $allowed_mimetypes, $maxfilesize, $maxfilewidth, $maxfileheight);
     if ($uploader->fetchMedia($post_field)) {
         if (!isset($response)) {
             $uploader->setTargetFileName($ticketid . "_" . $uploader->getMediaName());
         } else {
             $uploader->setTargetFileName($ticketid . "_" . $response . "_" . $uploader->getMediaName());
         }
         if ($uploader->upload()) {
             $hFile =& xhelpGetHandler('file');
             $file =& $hFile->create();
             $file->setVar('filename', $uploader->getSavedFileName());
             $file->setVar('ticketid', $ticketid);
             $file->setVar('mimetype', $allowed_mimetypes);
             $file->setVar('responseid', isset($response) ? intval($response) : 0);
             if ($hFile->insert($file)) {
                 return $file;
             } else {
                 return $uploader->getErrors();
             }
         } else {
             return $uploader->getErrors();
         }
     }
 }
开发者ID:trabisdementia,项目名称:xuups,代码行数:43,代码来源:responses.php

示例4: smartsection_pagewrap_upload

function smartsection_pagewrap_upload(&$errors)
{
    include_once SMARTSECTION_ROOT_PATH . "class/uploader.php";
    global $xoopsUser, $xoopsDB, $xoopsModule, $xoopsModule, $xoopsModuleConfig;
    include_once SMARTSECTION_ROOT_PATH . 'class/uploader.php';
    $config =& smartsection_getModuleConfig();
    $post_field = 'fileupload';
    //$allowed_mimetypes = '';
    // TODO : this needs to be managed by the MimeType section but we need a new parameter for allowed mimetype for pagewrap
    /*	if(!isset($allowed_mimetypes)){
           $hMime =& xoops_getmodulehandler('mimetype');
           $allowed_mimetypes = $hMime->checkMimeTypes($post_field);
           if(!$allowed_mimetypes){
           	$errors[] = _SMARTSECTION_MESSAGE_WRONG_MIMETYPE;
               return false;
           }
       }*/
    /*$maxfilesize = $config['xhelp_uploadSize'];
      $maxfilewidth = $config['xhelp_uploadWidth'];
      $maxfileheight = $config['xhelp_uploadHeight'];*/
    $max_size = $xoopsModuleConfig['maximum_filesize'];
    $max_imgwidth = $xoopsModuleConfig['maximum_image_width'];
    $max_imgheight = $xoopsModuleConfig['maximum_image_height'];
    if (!is_dir(smartsection_getUploadDir(true, 'content'))) {
        mkdir(smartsection_getUploadDir(true, 'content'), 0757);
    }
    $allowed_mimetypes = array('text/html', 'text/plain', 'application/xhtml+xml');
    $uploader = new XoopsMediaUploader(smartsection_getUploadDir(true, 'content') . '/', $allowed_mimetypes, $max_size, $max_imgwidth, $max_imgheight);
    if ($uploader->fetchMedia($post_field)) {
        $uploader->setTargetFileName($uploader->getMediaName());
        if ($uploader->upload()) {
            return true;
        } else {
            $errors = array_merge($errors, $uploader->getErrors(false));
            return false;
        }
    } else {
        $errors = array_merge($errors, $uploader->getErrors(false));
        return false;
    }
}
开发者ID:severnaya99,项目名称:Sg-2010,代码行数:41,代码来源:pw_upload_file.php

示例5: createFile

 function createFile($eventId)
 {
     $userId = $GLOBALS['xoopsUser'] ? $GLOBALS['xoopsUser']->getVar('uid') : 0;
     $allowedMimeType = array();
     $mimeType = (include XOOPS_ROOT_PATH . '/class/mimetypes.inc.php');
     foreach ($GLOBALS['xoopsModuleConfig']['allowed_file_extention'] as $fileExt) {
         $allowedMimeType[] = $mimeType[$fileExt];
     }
     $uploader = new XoopsMediaUploader(XOOPS_ROOT_PATH . '/uploads/extcal', $allowedMimeType, 3145728);
     $uploader->setPrefix($userId . '-' . $eventId . '_');
     if ($uploader->fetchMedia('event_file')) {
         if (!$uploader->upload()) {
             return false;
         }
     } else {
         return false;
     }
     $data = array('file_name' => $uploader->getSavedFileName(), 'file_nicename' => $uploader->getMediaName(), 'file_mimetype' => $uploader->getMediaType(), 'file_size' => $_FILES['event_file']['size'], 'file_date' => time(), 'file_approved' => 1, 'event_id' => $eventId, 'uid' => $userId);
     $file = $this->create();
     $file->setVars($data);
     return $this->insert($file);
 }
开发者ID:severnaya99,项目名称:Sg-2010,代码行数:22,代码来源:file.php

示例6: foreach

                 $tpl->setVar('tpl_source', $fsource, true);
                 @unlink($uploader->getSavedDestination());
                 if (!$tpltpl_handler->insert($tpl)) {
                     $msg[] = 'Failed inserting data for ' . $upload_file . ' to database';
                 } else {
                     $msg[] = 'Template file <b>' . $upload_file . '</b> updated.';
                     if ($tplset == $xoopsConfig['template_set']) {
                         include_once XOOPS_ROOT_PATH . '/class/template.php';
                         if (xoops_template_touch($tpl->getVar('tpl_id'), true)) {
                             $msg[] = 'Template file <b>' . $upload_file . '</b> compiled.';
                         }
                     }
                 }
             }
         } else {
             if ($uploader->getMediaName() == '') {
                 continue;
             } else {
                 $msg[] = $uploader->getErrors();
             }
         }
     }
     xoops_cp_header();
     echo '<code>';
     foreach ($msg as $m) {
         echo $m . '<br />';
     }
     echo '</code><br /><a href="admin.php?fct=tplsets&amp;op=listtpl&amp;tplset=' . $tplset . '&amp;moddir=' . $moddir . '">' . _MD_AM_BTOTADMIN . '</a>';
     xoops_cp_footer();
     break;
 case 'importtpl':
开发者ID:BackupTheBerlios,项目名称:xoops4-svn,代码行数:31,代码来源:main.php

示例7: storeUpload

 /**
  * @param string      $post_field
  * @param array       $allowed_mimetypes
  * @param array       $errors
  *
  * @return bool
  */
 public function storeUpload($post_field, $allowed_mimetypes = array(), &$errors)
 {
     $itemid = $this->getVar('itemid');
     if (empty($allowed_mimetypes)) {
         $allowed_mimetypes = $this->publisher->getMimetypeHandler()->getArrayByType();
     }
     $maxfilesize = $this->publisher->getConfig('maximum_filesize');
     $maxfilewidth = $this->publisher->getConfig('maximum_image_width');
     $maxfileheight = $this->publisher->getConfig('maximum_image_height');
     if (!is_dir(PublisherUtils::getUploadDir())) {
         mkdir(PublisherUtils::getUploadDir(), 0757);
     }
     $uploader = new XoopsMediaUploader(PublisherUtils::getUploadDir() . '/', $allowed_mimetypes, $maxfilesize, $maxfilewidth, $maxfileheight);
     if ($uploader->fetchMedia($post_field)) {
         $uploader->setTargetFileName($itemid . "_" . $uploader->getMediaName());
         if ($uploader->upload()) {
             $this->setVar('filename', $uploader->getSavedFileName());
             if ($this->getVar('name') == '') {
                 $this->setVar('name', $this->getNameFromFilename());
             }
             $this->setVar('mimetype', $uploader->getMediaType());
             return true;
         } else {
             $errors = array_merge($errors, $uploader->getErrors(false));
             return false;
         }
     } else {
         $errors = array_merge($errors, $uploader->getErrors(false));
         return false;
     }
 }
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:38,代码来源:file.php

示例8: isset

 $HotelObj->setVar('hotel_tags', isset($_POST['hotel_tags']) ? addslashes($_POST['hotel_tags']) : '');
 $HotelObj->setVar('hotel_description', isset($_POST['hotel_description']) ? addslashes($_POST['hotel_description']) : '');
 $HotelObj->setVar('hotel_star', isset($_POST['hotel_star']) ? intval($_POST['hotel_star']) : 0);
 $HotelObj->setVar('hotel_address', isset($_POST['hotel_address']) ? addslashes($_POST['hotel_address']) : '');
 $HotelObj->setVar('hotel_telephone', isset($_POST['hotel_telephone']) ? addslashes($_POST['hotel_telephone']) : '');
 $HotelObj->setVar('hotel_fax', isset($_POST['hotel_fax']) ? addslashes($_POST['hotel_fax']) : '');
 $HotelObj->setVar('hotel_room_count', isset($_POST['hotel_room_count']) ? intval($_POST['hotel_room_count']) : 0);
 //file upload
 $hotel_icon = isset($_POST['hotel_icon_old']) ? $_POST['hotel_icon_old'] : null;
 include XOOPS_ROOT_PATH . '/class/uploader.php';
 if (!empty($_FILES['hotel_icon']['tmp_name'])) {
     $path = MARTIN_ROOT_PATH . '/images/hotelicon/';
     $FileTypeUpload = array("image/jpg", "image/png", "image/gif", "image/jpeg");
     $uploader = new XoopsMediaUploader($path, $FileTypeUpload, 2048 * 1024);
     if ($uploader->fetchMedia($_POST["xoops_upload_file"][0])) {
         $uploader->ext = strtolower(ltrim(strrchr($uploader->getMediaName(), '.'), '.'));
         $SaveFileName = time() . rand(1000, 10000) . "." . $uploader->ext;
         $uploader->setTargetFileName($SaveFileName);
         if (!$uploader->upload()) {
             xoops_error($uploader->getErrors());
             exit;
         } elseif (file_exists($uploader->getSavedDestination())) {
             //delete images
             if (!empty($hotel_icon)) {
                 unlink(MARTIN_ROOT_PATH . '/images/hotelicon/' . $hotel_icon);
             }
             $hotel_icon = $uploader->getSavedFileName();
         }
     } else {
         xoops_error($uploader->getErrors());
     }
开发者ID:ponvino,项目名称:xoops-martin,代码行数:31,代码来源:martin.hotel.php

示例9: XoopsMediaUploader

 }
 $allowed_mimetypes = $att_handler->getTypes();
 $maxfilesize = 50000000;
 $uploader = new XoopsMediaUploader($files_dir, $allowed_mimetypes, $maxfilesize);
 foreach ($_POST["xoops_upload_file"] as $k => $v) {
     if ($uploader->fetchMedia($v)) {
         $uploader->setPrefix('support_');
         if (!$uploader->upload()) {
             echo $uploader->getErrors();
         } else {
             $att_obj =& $att_handler->create();
             $att_obj->setVar('res_id', $res_id);
             if (!empty($xoopsUser)) {
                 $att_obj->setVar('uid', $xoopsUser->getVar("uid"));
             }
             $att_obj->setVar("att_filename", $uploader->getMediaName());
             $att_obj->setVar("att_attachment", $uploader->getSavedFileName());
             $att_obj->setVar("att_type", $uploader->getMediaType());
             $att_obj->setVar("att_size", $uploader->getMediaSize());
             $att_obj->setVar("grate_time", time());
             $att_obj->setVar("update_time", time());
             $att_handler->insert($att_obj);
             $att_num = $att_num + 1;
         }
         unset($att_obj);
     }
 }
 //update resources res_attachment
 $res_obj =& $resources_handler->get($res_id);
 $res_obj->setVar('res_attachment', $att_num);
 $resources_handler->insert($res_obj);
开发者ID:yunsite,项目名称:xoopsdc,代码行数:31,代码来源:action.resources.php

示例10: stripslashes

     if (isset($_POST['xoops_upload_file'])) {
         $fldname = $_FILES[$_POST['xoops_upload_file'][0]];
         $fldname = get_magic_quotes_gpc() ? stripslashes($fldname['name']) : $fldname['name'];
         if (xoops_trim($fldname != '')) {
             $sfiles = new sFiles();
             $destname = $sfiles->createUploadName(XOOPS_UPLOAD_PATH, $fldname);
             /**
              * You can attach files to your news
              */
             $permittedtypes = explode("\n", str_replace("\r", '', news_getmoduleoption('mimetypes')));
             array_walk($permittedtypes, 'trim');
             $uploader = new XoopsMediaUploader(XOOPS_UPLOAD_PATH, $permittedtypes, $xoopsModuleConfig['maxuploadsize']);
             $uploader->setTargetFileName($destname);
             if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) {
                 if ($uploader->upload()) {
                     $sfiles->setFileRealName($uploader->getMediaName());
                     $sfiles->setStoryid($story->storyid());
                     $sfiles->setMimetype($sfiles->giveMimetype(XOOPS_UPLOAD_PATH . '/' . $uploader->getMediaName()));
                     $sfiles->setDownloadname($destname);
                     if (!$sfiles->store()) {
                         echo _AM_UPLOAD_DBERROR_SAVE;
                     }
                 } else {
                     echo _AM_UPLOAD_ERROR . ' ' . $uploader->getErrors();
                 }
             } else {
                 echo $uploader->getErrors();
             }
         }
     }
 }
开发者ID:BackupTheBerlios,项目名称:haxoo-svn,代码行数:31,代码来源:submit.php

示例11: storeUpload

 function storeUpload($post_field, $allowed_mimetypes = null, &$errors)
 {
     global $xoopsUser, $xoopsDB, $xoopsModule;
     include_once SMARTPARTNER_ROOT_PATH . 'class/uploader.php';
     $config =& smartpartner_getModuleConfig();
     $id = $this->getVar('id');
     if (!isset($allowed_mimetypes)) {
         $hMime =& xoops_getmodulehandler('mimetype');
         $allowed_mimetypes = $hMime->checkMimeTypes($post_field);
         if (!$allowed_mimetypes) {
             return false;
         }
     }
     /*$maxfilesize = $config['xhelp_uploadSize'];
       $maxfilewidth = $config['xhelp_uploadWidth'];
       $maxfileheight = $config['xhelp_uploadHeight'];*/
     $maxfilesize = $config['maximum_filesize'];
     $maxfilewidth = 100000;
     //$config['maximum_image_width'];
     $maxfileheight = 100000;
     //$config['maximum_image_height'];
     if (!is_dir(smartpartner_getUploadDir())) {
         mkdir(smartpartner_getUploadDir(), 0757);
     }
     $uploader = new XoopsMediaUploader(smartpartner_getUploadDir() . '/', $allowed_mimetypes, $maxfilesize, $maxfilewidth, $maxfileheight);
     if ($uploader->fetchMedia($post_field)) {
         $file_title = $this->purifyText($uploader->getMediaName());
         $uploader->setTargetFileName($id . "_" . $file_title);
         if ($uploader->upload()) {
             $this->setVar('filename', $uploader->getSavedFileName());
             if ($this->getVar('name') == '') {
                 $this->setVar('name', $this->getNameFromFilename());
             }
             $this->setVar('mimetype', $uploader->getMediaType());
             return true;
         } else {
             $errors = array_merge($errors, $uploader->getErrors(false));
             return false;
         }
     } else {
         $errors = array_merge($errors, $uploader->getErrors(false));
         return false;
     }
 }
开发者ID:trabisdementia,项目名称:xuups,代码行数:44,代码来源:file.php

示例12: array

     $extendmimetypes = array('rar' => 'application/octet-stream');
     $maxfilesize = 50000000;
     $maxfilewidth = 1200;
     $maxfileheight = 1200;
     $uploader = new XoopsMediaUploader($files_dir, $allowed_mimetypes, $maxfilesize, null, null, $extendmimetypes);
     foreach ($_POST["xoops_upload_file"] as $k => $v) {
         if ($uploader->fetchMedia($v)) {
             $uploader->setPrefix('support_');
             if (!$uploader->upload()) {
                 echo $uploader->getErrors();
             } else {
                 $annex_obj =& $annex_handler->create();
                 $annex_obj->setVar('pro_id', $pro_id);
                 $annex_obj->setVar('tran_id', $tran_id);
                 $annex_obj->setVar('uid', $user['uid']);
                 $annex_obj->setVar('annex_title', $uploader->getMediaName());
                 $annex_obj->setVar('annex_file', $uploader->getSavedFileName());
                 $annex_obj->setVar('annex_type', $uploader->getMediaType());
                 $annex_handler->insert($annex_obj);
                 // thumbs
                 /*
                 if(in_array($uploader->getMediaType(), $allowed_mimetypes)) {
                     setImageThumb($files_dir."/", $uploader->getSavedFileName(), $files_dir."/", 'mid_'.$uploader->getSavedFileName(), array($mid_wh[0], $mid_wh[1]));
                     setImageThumb($files_dir."/", $uploader->getSavedFileName(), $files_dir."/", 'thumb_'.$uploader->getSavedFileName(), array($thumb_wh[0], $thumb_wh[1]));
                 }
                 */
             }
             unset($annex_obj);
         }
     }
 }
开发者ID:yunsite,项目名称:xoopsdc,代码行数:31,代码来源:action.php

示例13: stripslashes

				if(isset($_POST['xoops_upload_file'])) {
					$fldname = $_FILES[$_POST['xoops_upload_file'][0]];
					$fldname = (get_magic_quotes_gpc()) ? stripslashes($fldname['name']) : $fldname['name'];
					if(xoops_trim($fldname!='')) {
						$sfiles = new nw_sFiles();
						$destname=$sfiles->createUploadName(NW_ATTACHED_FILES_PATH,$fldname);
						/**
						 * You can attach files to your news
						 */
						$permittedtypes = explode("\n",str_replace("\r",'',nw_getmoduleoption('mimetypes', NW_MODULE_DIR_NAME)));
						array_walk($permittedtypes, 'trim');
						$uploader = new XoopsMediaUploader( NW_ATTACHED_FILES_PATH, $permittedtypes, $xoopsModuleConfig['maxuploadsize']);
						$uploader->setTargetFileName($destname);
						if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) {
							if ($uploader->upload()) {
								$sfiles->setFileRealName($uploader->getMediaName());
								$sfiles->setStoryid($story->storyid());
								$sfiles->setMimetype($sfiles->giveMimetype(NW_ATTACHED_FILES_PATH.'/'.$uploader->getMediaName()));
								$sfiles->setDownloadname($destname);
								if(!$sfiles->store()) {
									echo _AM_NW_UPLOAD_DBERROR_SAVE;
								}
							} else {
								echo _AM_NW_UPLOAD_ERROR. ' ' . $uploader->getErrors();
							}
						} else {
							echo $uploader->getErrors();
						}
					}
				}
			}
开发者ID:severnaya99,项目名称:Sg-2010,代码行数:31,代码来源:submit.php


注:本文中的XoopsMediaUploader::getMediaName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。