当前位置: 首页>>代码示例>>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;未经允许,请勿转载。