當前位置: 首頁>>代碼示例>>PHP>>正文


PHP qqFileUploader::getUploadName方法代碼示例

本文整理匯總了PHP中qqFileUploader::getUploadName方法的典型用法代碼示例。如果您正苦於以下問題:PHP qqFileUploader::getUploadName方法的具體用法?PHP qqFileUploader::getUploadName怎麽用?PHP qqFileUploader::getUploadName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在qqFileUploader的用法示例。


在下文中一共展示了qqFileUploader::getUploadName方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: upload

 protected function upload()
 {
     $tempFolder = Yii::getPathOfAlias('webroot') . self::TMP_DIR;
     @mkdir($tempFolder, 0777, TRUE);
     @mkdir($tempFolder . 'chunks', 0777, TRUE);
     Yii::import("ext.EFineUploader.qqFileUploader");
     $uploader = new qqFileUploader();
     $uploader->allowedExtensions = array('jpg', 'jpeg', 'png', 'gif');
     $uploader->sizeLimit = 7 * 1024 * 1024;
     //maximum file size in bytes
     $uploader->chunksFolder = $tempFolder . 'chunks';
     $result = $uploader->handleUpload($tempFolder);
     $result['filename'] = $uploader->getUploadName();
     $result['folder'] = $webFolder;
     $key = $_POST['key'];
     $tmp = new TmpUploads();
     $tmp->key = $key;
     $tmp->deleteUsersUploads($this->single);
     if (!ini_get('file_uploads')) {
         $tmp->error('Загрузка файлов запрещена настройками сервера');
         return;
     }
     if (isset($result['error'])) {
         $tmp->error($result['error']);
     }
     $tmp->add(self::TMP_DIR . $result['filename']);
     header("Content-Type: text/plain");
     $result = htmlspecialchars(json_encode($result), ENT_NOQUOTES);
     echo $result;
     Yii::app()->end();
 }
開發者ID:hit-shappens,項目名稱:testapp,代碼行數:31,代碼來源:AjaxUploadAction.php

示例2: main

 public function main()
 {
     // Post CODE is to let the uploader know what to do with the file when complete.
     $code = $_POST['code'];
     $this->ajax = true;
     // Include the uploader class
     $uploader = new qqFileUploader();
     // Specify the list of valid extensions, ex. array("jpeg", "xml", "bmp")
     $uploader->allowedExtensions = array();
     // Specify max file size in bytes.
     $uploader->sizeLimit = 10 * 1024 * 1024;
     // Specify the input name set in the javascript.
     $uploader->inputName = 'qqfile';
     // If you want to use resume feature for uploader, specify the folder to save parts.
     $uploader->chunksFolder = config::AJAX_CHUNK_FOLDER;
     // Call handleUpload() with the name of the folder, relative to PHP's getcwd()
     $result = $uploader->handleUpload(config::AJAX_UPLOAD_FOLDER);
     // To save the upload with a specified name, set the second parameter.
     // $result = $uploader->handleUpload('uploads/', md5(mt_rand()).'_'.$uploader->getName());
     // To return a name used for uploaded file you can use the following line.
     $result['uploadName'] = $uploader->getUploadName();
     if ($result['uploadName']) {
         $this->processFile($result['uploadName'], $code);
     }
     // Lets just save this in a universal holding pattern.
     header("Content-Type: text/plain");
     echo json_encode($result);
 }
開發者ID:carriercomm,項目名稱:atikit,代碼行數:28,代碼來源:upload.php

示例3: actionUpload

 public function actionUpload()
 {
     $tempFolder = Yii::getPathOfAlias('webroot') . Yii::app()->params['upload_path'];
     mkdir($tempFolder, 0777, TRUE);
     mkdir($tempFolder . 'chunks', 0777, TRUE);
     Yii::import("ext.EFineUploader.qqFileUploader");
     $uploader = new qqFileUploader();
     $uploader->allowedExtensions = Yii::app()->params['upload_ext'];
     $uploader->sizeLimit = $this->MAX_UPLOAD_SIZE;
     //maximum file size in bytes
     $uploader->chunksFolder = $tempFolder . 'chunks';
     $result = $uploader->handleUpload($tempFolder);
     $result['filename'] = $uploader->getUploadName();
     $savedfile = $result['filename'];
     $result['folder'] = $webFolder;
     $uploadedFile = $tempFolder . $result['filename'];
     $uploaded = 1;
     header("Content-Type: text/plain");
     //echo Yii::getPathOfAlias('webroot').Yii::app()->params['upload_path'];
     if ($uploaded) {
         $video = new EventMedia();
         $video->e_id = 0;
         $video->path = Yii::app()->params['upload_path'] . $savedfile;
         if (strstr(mime_content_type(Yii::getPathOfAlias('webroot') . $video->path), "video")) {
             $video->type = $this->LOCALVID;
             $video->name = "Local Video";
         } elseif (strstr(mime_content_type(Yii::getPathOfAlias('webroot') . $video->path), "image")) {
             $video->type = $this->IMAGE;
             $video->name = "Local Image";
             //resize image
             $image = Yii::app()->image->load(Yii::getPathOfAlias('webroot') . $video->path);
             $image->quality(6);
             $fname = $video->path;
             if ($image->__get("width") > 3200) {
                 $pfile = dirname($fname) . "/big." . basename($fname);
                 $image->resize(3200);
                 $image->save(Yii::getPathOfAlias('webroot') . $pfile);
             } else {
                 $pfile = dirname($fname) . "/big." . basename($fname);
                 $image->save(Yii::getPathOfAlias('webroot') . $pfile);
             }
             $pfile = dirname($fname) . "/medium." . basename($fname);
             $image->resize(800);
             $image->save(Yii::getPathOfAlias('webroot') . $pfile);
             $pfile = dirname($fname) . "/small." . basename($fname);
             $image->resize(400);
             $image->save(Yii::getPathOfAlias('webroot') . $pfile);
         }
         if ($video->save()) {
             $result['id'] = $video->primaryKey;
             $result = htmlspecialchars(json_encode($result), ENT_NOQUOTES);
             echo $result;
         }
     }
     Yii::app()->end();
 }
開發者ID:snipesn,項目名稱:UkrYama-2,代碼行數:56,代碼來源:VideoController.php

示例4: run

 public function run()
 {
     $tempFolder = Yii::getPathOfAlias('webroot') . '/upload/video/';
     @mkdir($tempFolder, 0777, TRUE);
     @mkdir($tempFolder . 'chunks', 0777, TRUE);
     Yii::import("ext.EFineUploader.qqFileUploader");
     $uploader = new qqFileUploader();
     $uploader->allowedExtensions = array('mp4', 'flv');
     $uploader->sizeLimit = 2 * 1024 * 1024;
     //maximum file size in bytes
     $uploader->chunksFolder = $tempFolder . 'chunks';
     $result = $uploader->handleUpload($tempFolder);
     $result['filename'] = $uploader->getUploadName();
     $result['folder'] = $webFolder;
     $uploadedFile = $tempFolder . $result['filename'];
     header("Content-Type: text/plain");
     $result = htmlspecialchars(json_encode($result), ENT_NOQUOTES);
     echo $result;
     Yii::app()->end();
 }
開發者ID:snipesn,項目名稱:UkrYama-2,代碼行數:20,代碼來源:EFineUploaderAction.php

示例5: actionUpload

 /**
  * File uploader controller
  */
 public function actionUpload()
 {
     $webFolder = '/uploads/htmlcode/';
     $tempFolder = Yii::app()->basePath . '/../www' . $webFolder;
     @mkdir($tempFolder, 0777, TRUE);
     @mkdir($tempFolder . 'chunks', 0777, TRUE);
     Yii::import("ext.EFineUploader.qqFileUploader");
     $uploader = new qqFileUploader();
     $uploader->allowedExtensions = array('jpg', 'jpeg', 'png', 'gif');
     $uploader->sizeLimit = 2 * 1024 * 1024;
     //maximum file size in bytes
     $uploader->chunksFolder = $tempFolder . 'chunks';
     $result = $uploader->handleUpload($tempFolder);
     $result['filename'] = $uploader->getUploadName();
     $result['folder'] = $webFolder;
     $uploadedFile = $tempFolder . $result['filename'];
     header("Content-Type: text/plain");
     $result = htmlspecialchars(json_encode($result), ENT_NOQUOTES);
     echo $result;
     Yii::app()->end();
 }
開發者ID:Diakonrus,項目名稱:fastweb-yii,代碼行數:24,代碼來源:HtmlcodeController.php

示例6: upload

 public function upload()
 {
     require_once 'qqFileUploader.php';
     $uploader = new qqFileUploader();
     $uploader->inputName = 'qqfile';
     // Set the allowed file types based on config.
     $allowedFileTypes = C("plugin.Attachments.allowedFileTypes");
     if (!empty($allowedFileTypes)) {
         $uploader->allowedExtensions = $allowedFileTypes;
     }
     // Set the max file size based on config.
     if ($size = C("plugin.Attachments.maxFileSize")) {
         $uploader->sizeLimit = $size;
     }
     // Generate a unique ID and secret for this attachment.
     $attachmentId = uniqid();
     $secret = generateRandomString(13, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890");
     $name = $uploader->getName();
     // Save it to the filesystem.
     $model = ET::getInstance("attachmentModel");
     $result = $uploader->handleUpload($model->path(), $attachmentId . $secret);
     if (!empty($result["success"])) {
         $result['uploadName'] = $uploader->getUploadName();
         // Save attachment information to the session.
         $session = (array) ET::$session->get("attachments");
         $session[$attachmentId] = array("postId" => R("postId"), "name" => $name, "secret" => $secret);
         ET::$session->store("attachments", $session);
     }
     header("Content-Type: text/plain");
     echo json_encode($result);
 }
開發者ID:AlexandrST,項目名稱:esoTalk,代碼行數:31,代碼來源:AttachmentController.class.php

示例7: json_encode

<?php

/**
 * 上傳調用文件
 */
header('Content-Type:text/html;charset=utf-8');
//引入核心類
require_once 'qqFileUploader.php';
$uploader = new qqFileUploader();
//製定上傳文件的擴展名  ex. array("jpeg", "xml", "bmp")
$uploader->allowedExtensions = array('jpg');
//留空可以允許所有文件
//設置上傳文件字節大小
$uploader->sizeLimit = 10 * 1024 * 1024;
// 指定在JavaScript中輸入名稱。
//Specify the input name set in the javascript.
$uploader->inputName = 'qqfile';
// 如果你想使用恢複功能,上傳,指定要保存的文件夾。
//If you want to use resume feature for uploader, specify the folder to save parts.
$uploader->chunksFolder = 'chunks';
// 以指定的名稱保存上傳,的第二個參數設置。
//To save the upload with a specified name, set the second parameter.
$result = $uploader->handleUpload('uploads/', $uploader->getName());
//已引用入口文件地址為準
//返回一個用於上傳文件,你可以使用下麵的行名稱。
//To return a name used for uploaded file you can use the following line.
$result['uploadName'] = $uploader->getUploadName();
header("Content-Type: text/plain");
echo json_encode($result);
開發者ID:JasonWiki,項目名稱:docs,代碼行數:29,代碼來源:example.php

示例8: actionUploadcc

 public function actionUploadcc()
 {
     $tempFolder = Yii::getPathOfAlias('application') . '/upload/temp/';
     $folder = Yii::getPathOfAlias('webroot') . '/files/' . uid() . DS;
     if (!file_exists($folder)) {
         mkdir($folder, 0777, true);
     }
     Yii::import("ext.EFineUploader.qqFileUploader");
     $uploader = new qqFileUploader();
     $uploader->allowedExtensions = array('vtt');
     $uploader->sizeLimit = 50 * 1024 * 1024;
     $uploader->chunksFolder = $tempFolder . 'chunks';
     $result = $uploader->handleUpload($tempFolder);
     $result['filename'] = $uploader->getUploadName();
     $uploadedFile = $tempFolder . $result['filename'];
     if (!copy($tempFolder . $result["filename"], $folder . $result['filename'])) {
         echo "false!";
     } else {
         unlink($tempFolder . $result["filename"]);
     }
     header("Content-Type: text/plain");
     $result = htmlspecialchars(json_encode($result), ENT_NOQUOTES);
     echo $result;
     Yii::app()->end();
 }
開發者ID:rajveer4155,項目名稱:vidmgr,代碼行數:25,代碼來源:VideoController.php

示例9: convertStringToArray

if (@ini_get('upload_max_filesize')) {
    $upload_max_filesize = return_bytes(ini_get('upload_max_filesize'));
    if ($upload_max_filesize < $phpwcms['file_maxsize']) {
        $phpwcms['file_maxsize'] = $upload_max_filesize - 1;
    }
} else {
    $upload_max_filesize = $phpwcms['file_maxsize'];
}
if (is_string($phpwcms['allowed_upload_ext'])) {
    $phpwcms['allowed_upload_ext'] = convertStringToArray(strtolower($phpwcms['allowed_upload_ext']));
}
$uploader = new qqFileUploader($phpwcms['allowed_upload_ext'], min($post_max_size, $upload_max_filesize, $phpwcms['file_maxsize']));
$uploadDir = PHPWCMS_ROOT . $phpwcms["ftp_path"];
// Call handleUpload() with the name of the folder, relative to PHP's getcwd()
$result = $uploader->handleUpload($uploadDir, NULL, TRUE, FALSE);
$result['filename'] = $uploader->getUploadName();
if (!empty($result['success']) && !empty($_GET['file_public'])) {
    require_once PHPWCMS_ROOT . '/include/inc_lib/dbcon.inc.php';
    $data = array('f_pid' => intval($_GET['file_dir']), 'f_uid' => intval($_SESSION["wcs_user_id"]), 'f_kid' => 1, 'f_aktiv' => 1, 'f_public' => 1, 'f_name' => $result['filename'], 'f_created' => now(), 'f_size' => $uploader->getFileSize(), 'f_type' => $uploader->getFileType(), 'f_ext' => strtolower($uploader->getFileExtension()), 'f_longinfo' => slweg($_GET['file_longinfo']), 'f_hash' => md5($result['filename'] . microtime()), 'f_copyright' => slweg($_GET['file_copyright']), 'f_tags' => clean_slweg($_GET['file_tags']));
    if (PHPWCMS_CHARSET != 'utf-8') {
        $data['f_name'] = makeCharsetConversion($data['f_name'], 'utf-8', PHPWCMS_CHARSET);
        $data['f_longinfo'] = makeCharsetConversion($data['f_longinfo'], 'utf-8', PHPWCMS_CHARSET);
        $data['f_copyright'] = makeCharsetConversion($data['f_copyright'], 'utf-8', PHPWCMS_CHARSET);
        $data['f_tags'] = makeCharsetConversion($data['f_tags'], 'utf-8', PHPWCMS_CHARSET);
    }
    $insert = _dbInsert('phpwcms_file', $data);
    // move uploaded file
    if (!empty($insert['INSERT_ID'])) {
        $userftppath = PHPWCMS_ROOT . $phpwcms["ftp_path"];
        $useruploadpath = PHPWCMS_ROOT . $phpwcms["file_path"];
        $usernewfile = $useruploadpath . $data['f_hash'];
開發者ID:Ideenkarosell,項目名稱:phpwcms,代碼行數:31,代碼來源:act_upload.php

示例10: upload

    public function upload()
    {
         require('Public/qqFileUploader.php');
         $uploader = new \qqFileUploader();

        // Specify the list of valid extensions, ex. array("jpeg", "xml", "bmp")
        $uploader->allowedExtensions = array("apk", "ipa", "zip");

        // Specify max file size in bytes.
        $uploader->sizeLimit = 100 * 1024 * 1024;

        // Specify the input name set in the javascript.
        $uploader->inputName = 'qqfile';

        // If you want to use resume feature for uploader, specify the folder to save parts.
        $uploader->chunksFolder = 'chunks';

        // Call handleUpload() with the name of the folder, relative to PHP's getcwd()
        //$result = $uploader->handleUpload('Uploads');
        $ext = getFileExt($uploader->getName());
        $platform = getPlatformType($uploader->getName());
        $filename = $platform .'_'. time().'_'.mt_rand().'.'.$ext;

        // To save the upload with a specified name, set the second parameter.
        //$result = $uploader->handleUpload($this->upload, $filename);
        if($ext == 'zip')
        {
            $filename = $uploader->getName();
        }
        $result = $uploader->handleUpload($this->upload, $filename);

        // To return a name used for uploaded file you can use the following line.
        $result['uploadName'] = $uploader->getUploadName();
        header("Content-Type: text/plain");
        echo json_encode($result);
    }
開發者ID:selecterskyphp,項目名稱:appstore,代碼行數:36,代碼來源:IndexController.class.php


注:本文中的qqFileUploader::getUploadName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。