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


PHP qqFileUploader类代码示例

本文整理汇总了PHP中qqFileUploader的典型用法代码示例。如果您正苦于以下问题:PHP qqFileUploader类的具体用法?PHP qqFileUploader怎么用?PHP qqFileUploader使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: upload

 /**
  * @brief Accion que se encarga de manipular el proceso de guardar
  * un archivo en el servidor
  * @param array $allowedExtensions Arreglo de extensiones validas para el archivo
  * @param int $sizeLimit Tamaño maximo permitido del fichero que se sube
  */
 function upload($allowedExtensions, $sizeLimit = 10485760)
 {
     jimport('Amadeus.Util.Uploader');
     $media =& JComponentHelper::getParams('com_media');
     $postSize = $this->toBytes(ini_get('post_max_size'));
     $uploadSize = $this->toBytes(ini_get('upload_max_filesize'));
     $mediaSize = (int) $media->get('upload_maxsize');
     // Se selecciona el minimo tamaño válido para un fichero, de acuerdo
     // a los valores configurados en el php, el joomla y el componente.
     $sizeLimit = min($postSize, $uploadSize, $mediaSize, $sizeLimit);
     // Se alamacena la imagen en la ruta especificada
     $uploader = new qqFileUploader($allowedExtensions, $sizeLimit);
     $result = $uploader->handleUpload(JPATH_SITE . '/tmp/', true);
     if (!isset($result['error'])) {
         jimport('Amadeus.Util.Validation');
         $file = $uploader->getName();
         $result = AmadeusUtilValidation::isValidFile($file, $only_image);
         if (isset($result['error'])) {
             jimport('joomla.filesystem.file');
             if (!JFile::delete($file)) {
                 $result = array('error' => JText::_('DELETEERROR'));
             }
         } else {
             $this->_file = $file;
         }
     }
     return $result;
 }
开发者ID:jmangarret,项目名称:webtuagencia24,代码行数:34,代码来源:File.php

示例2: actionUploadLogo

 /**
  * Upload logo LbInvoice or LbQuotation
  */
 public function actionUploadLogo($sub_cription, $company_id)
 {
     Yii::import("ext.EAjaxUpload.qqFileUploader");
     $folder = 'images/logo/';
     // folder for uploaded files
     $file_arr = array_diff(scandir($folder), array('.', '..'));
     foreach ($file_arr as $key => $file) {
         $file_name = explode('.', $file);
         $file_name_arr = explode('_', $file_name[0]);
         if ($file_name_arr[0] == $sub_cription && $file_name_arr[1] == $company_id) {
             unlink($folder . $file);
         }
     }
     $allowedExtensions = array("jpeg", "jpg", "gif", "png");
     //array("jpg","jpeg","gif","exe","mov" and etc...
     $sizeLimit = 10 * 1024 * 1024;
     // maximum file size in bytes
     $uploader = new qqFileUploader($allowedExtensions, $sizeLimit);
     $result = $uploader->handleUpload($folder, false, $sub_cription, $company_id);
     $return = htmlspecialchars(json_encode($result), ENT_NOQUOTES);
     $fileSize = filesize($folder . $result['filename']);
     //GETTING FILE SIZE
     $fileName = $result['filename'];
     //GETTING FILE NAME
     return $return;
     // it's array
 }
开发者ID:Lucerin,项目名称:Yii-projects,代码行数:30,代码来源:CLBController.php

示例3: actionSubirDocumento

 public function actionSubirDocumento()
 {
     Yii::import("ext.EAjaxUpload.qqFileUploader");
     $folder = Yii::app()->getBasePath() . "/../upload/";
     // folder for uploaded files
     $allowedExtensions = array("pdf", "zip", "rar", "txt", "cvs", "doc", "docx", "xls", "xlsx", "ppt", "pptx");
     //array("jpg","jpeg","gif","exe","mov" and etc...
     $sizeLimit = 5 * 1024 * 1024;
     // maximum file size in bytes
     $uploader = new qqFileUploader($allowedExtensions, $sizeLimit);
     $result = $uploader->handleUpload($folder, true);
     $return = htmlspecialchars(json_encode($result), ENT_NOQUOTES);
     $fileName = $result['filename'];
     //GETTING FILE NAME
     $fileSize = filesize($folder . $result['filename']);
     //GETTING FILE SIZE
     $fileExt = $result['ext'];
     //GETTING FILE NAME
     $documento = new Documento();
     $documento->fecha_creacion = date("Y-m-d H:i:s");
     $documento->nombre = $fileName;
     $documento->usuario_id = Yii::app()->user->id;
     $documento->peso = $fileSize;
     $documento->extension = $fileExt;
     $documento->insert();
     echo $return;
     // it's array
 }
开发者ID:jencina,项目名称:checklist,代码行数:28,代码来源:DocumentoController.php

示例4: datos

 function datos($campo_id, $etapa_id)
 {
     $etapa = Doctrine::getTable('Etapa')->find($etapa_id);
     if (UsuarioSesion::usuario()->id != $etapa->usuario_id) {
         echo 'Usuario no tiene permisos para subir archivos en esta etapa';
         exit;
     }
     $campo = Doctrine_Query::create()->from('Campo c, c.Formulario.Pasos.Tarea.Etapas e')->where('c.id = ? AND e.id = ?', array($campo_id, $etapa_id))->fetchOne();
     if (!$campo) {
         echo 'Campo no existe';
         exit;
     }
     // list of valid extensions, ex. array("jpeg", "xml", "bmp")
     $allowedExtensions = array('gif', 'jpg', 'png', 'pdf', 'doc', 'docx', 'zip', 'rar', 'ppt', 'pptx', 'xls', 'xlsx', 'mpp', 'vsd');
     if (isset($campo->extra->filetypes)) {
         $allowedExtensions = $campo->extra->filetypes;
     }
     // max file size in bytes
     $sizeLimit = 20 * 1024 * 1024;
     $uploader = new qqFileUploader($allowedExtensions, $sizeLimit);
     $result = $uploader->handleUpload('uploads/datos/');
     if (isset($result['success'])) {
         $file = new File();
         $file->tramite_id = $etapa->Tramite->id;
         $file->filename = $result['file_name'];
         $file->tipo = 'dato';
         $file->llave = strtolower(random_string('alnum', 12));
         $file->save();
         $result['id'] = $file->id;
         $result['llave'] = $file->llave;
     }
     // to pass data through iframe you will need to encode all html tags
     echo htmlspecialchars(json_encode($result), ENT_NOQUOTES);
 }
开发者ID:chileindica,项目名称:SIMPLE,代码行数:34,代码来源:uploader.php

示例5: admin_add

 /**
  * Upload attachment
  *
  * @return void
  */
 public function admin_add()
 {
     $this->set('title_for_layout', __('Add attachment', true));
     $allowed_extensions = explode(',', Configure::read('Nodeattachment.allowedFileTypes'));
     $size_limit = Configure::read('Nodeattachment.maxFileSize') * 1024 * 1024;
     App::import('Vendor', 'Nodeattachment.file-uploader.php');
     $uploader = new qqFileUploader($allowed_extensions, $size_limit);
     $result = $uploader->handleUpload($this->uploads_path . DS);
     $uploader_file_name = $uploader->getFilename();
     if (isset($this->params['url']['node_id']) && $uploader_file_name != false) {
         $filename['name'] = Inflector::slug($uploader_file_name['filename']);
         $filename['ext'] = $uploader_file_name['ext'];
         $filename = $this->__uniqeSlugableFilename($filename);
         $old_path = $this->uploads_path . DS . $uploader_file_name['filename'] . '.' . $filename['ext'];
         $new_path = $this->uploads_path . DS . $filename['name'] . '.' . $filename['ext'];
         rename($old_path, $new_path);
         $data = array('node_id' => $this->params['url']['node_id'], 'slug' => $filename['name'] . '.' . $filename['ext'], 'path' => '/' . $this->uploads_dir . '/' . $filename['name'] . '.' . $filename['ext'], 'title' => $filename['name'], 'status' => 1, 'mime_type' => $this->__getMime($this->uploads_path . DS . $filename['name'] . '.' . $filename['ext']));
         // get shot time of photo
         if ($data['mime_type'] == 'image/jpeg' || $data['mime_type'] == 'image/tiff') {
             $exif_data = $this->Nodeattachment->getExif($new_path);
             if (isset($exif_data['DateTime'])) {
                 $data['created'] = $exif_data['DateTime'];
             }
         }
         if (!$this->Nodeattachment->save($data)) {
             $result = array('error' => __('The Attachment could not be saved. Please, try again.', true));
         }
     }
     Configure::write('debug', 0);
     $this->disableCache();
     $this->render(false);
     echo htmlspecialchars(json_encode($result), ENT_NOQUOTES);
 }
开发者ID:ryansnowden,项目名称:nodeattachment,代码行数:38,代码来源:nodeattachment_controller.php

示例6: upload

 function upload($data)
 {
     $max_width = Configure::read('Gallery.max_width');
     $thumb_width = Configure::read('Gallery.max_width_thumb');
     $thumb_height = Configure::read('Gallery.max_height_thumb');
     $thumb_quality = Configure::read('Gallery.quality');
     App::import('Vendor', 'Gallery.qqFileUploader', array('file' => 'qqFileUploader.php'));
     $uploader = new qqFileUploader();
     $result = $uploader->handleUpload($this->dir);
     $width = $this->getWidth($this->dir . $result['file']);
     $height = $this->getHeight($this->dir . $result['file']);
     if ($width > $max_width) {
         $scale = $max_width / $width;
         $this->resizeImage($this->dir . $result['file'], $width, $height, $scale);
     } else {
         $scale = 1;
         $this->resizeImage($this->dir . $result['file'], $width, $height, $scale);
     }
     if (empty($thumb_height) && !empty($thumb_width)) {
         $this->resizeImage2('resize', $result['file'], $this->dir, 'thumb_' . $result['file'], $thumb_width, FALSE, $thumb_quality);
     } elseif (empty($thumb_width) && !empty($thumb_height)) {
         $this->resizeImage2('resize', $result['file'], $this->dir, 'thumb_' . $result['file'], FALSE, $thumb_height, $thumb_quality);
     } else {
         $this->resizeImage2('resizeCrop', $result['file'], $this->dir, 'thumb_' . $result['file'], $thumb_width, $thumb_height, $thumb_quality);
     }
     $data['Photo']['small'] = 'thumb_' . $result['file'];
     $data['Photo']['large'] = $result['file'];
     return $data;
 }
开发者ID:vitorpacheco,项目名称:gallery,代码行数:29,代码来源:photo.php

示例7: actionUploadAvartar

 public function actionUploadAvartar()
 {
     $id = Yii::app()->request->getParam('id', 0);
     $type = Yii::app()->request->getParam('type', 'channel');
     if ($type == 'genre') {
         $pathUpload = self::_PATH_ICONS_UPLOAD . "genre" . DS;
     } elseif ($type == 'collection') {
         $pathUpload = self::_PATH_ICONS_UPLOAD . "collection" . DS;
     } elseif ($type == 'playlist') {
         $pathUpload = self::_PATH_ICONS_UPLOAD . "playlist" . DS;
     } elseif ($type == 'album') {
         $pathUpload = self::_PATH_ICONS_UPLOAD . "album" . DS;
     } else {
         $pathUpload = self::_PATH_ICONS_UPLOAD . "channel" . DS;
     }
     Yii::import("ext.EAjaxUpload.qqFileUploader");
     $allowedExtensions = array("png");
     //array("jpg","jpeg","gif","exe","mov" and etc...
     $sizeLimit = 100 * 1024 * 1024;
     // maximum file size in bytes
     $uploader = new qqFileUploader($allowedExtensions, $sizeLimit);
     $result = $uploader->handleUploadRadio($pathUpload, $id);
     if ($result['success']) {
         $result['data'] = self::_URL_ICONS_RADIO . $type . '/' . $result['filename'];
     } else {
         $result['data'] = '';
     }
     echo CJSON::encode($result);
 }
开发者ID:giangnh264,项目名称:mobileplus,代码行数:29,代码来源:DefaultController.php

示例8: actionBase

 public function actionBase($id, $name)
 {
     Yii::import("application.modules.file.components.qqFileUploader");
     $temp = Yii::getPathOfAlias('webroot') . DS . 'upload' . DS . 'temp' . DS;
     $folderName = $this->getFolder($id, $name);
     $dir = Yii::getPathOfAlias('webroot') . DS . 'upload' . DS . $this->module->uploadFolder . DS . $folderName . DS;
     //Загрузка файла на сервер
     $uploader = new qqFileUploader(Yii::app()->getModule('file')->getAllowedExt(Yii::app()->request->getParam('file_type')), $_GET['sizeLimit']);
     $result = $uploader->handleUpload($temp);
     $tempFile = Yii::app()->cFile->set($temp . Yii::app()->request->getParam('qqfile'), true);
     if (isset($result['success'])) {
         $cover = $_GET['cover'] == 'true' ? true : false;
         if (in_array(strtolower($tempFile->getExtension()), $this->module->imgExt)) {
             $modelId = $this->uploadImage($tempFile, $folderName, $dir, $id, $cover);
         } else {
             $modelId = $this->uploadFile($tempFile, $folderName, $dir, $id);
         }
         $html = $this->renderPartial('file_uploader.views._image', array('data' => FileManager::model()->findByPk($modelId), 'cover' => $cover), true);
         $tempFile->delete();
     }
     $html = str_replace("\r\n", '', $html);
     $result['imagedata'] = str_replace("\n", '', $html);
     $result = json_encode($result);
     echo $result;
 }
开发者ID:blrtromax,项目名称:seobility,代码行数:25,代码来源:UploadController.php

示例9: run

 /**
  * Widgets run function
  * @param integer $id
  * @param string $attribute
  * @throws CHttpException
  */
 public function run()
 {
     if (Yii::app()->getRequest()->isPostRequest) {
         if (!file_exists($this->uploadPath)) {
             throw new CHttpException(Yii::t('zii', 'Invalid upload path'));
         }
         $uploader = new qqFileUploader($this->allowedExtensions, $this->sizeLimit);
         $result = $uploader->handleUpload($this->uploadPath, true, session_id());
         $gd = new GdImage();
         // step 1: make a copy of the original
         $filePath = $this->uploadPath . '/' . $result['filename'];
         $copyName = $gd->createName($result['filename'], '_FULLSIZE');
         $gd->copy($filePath, $this->uploadPath . '/' . $copyName);
         // step 2: Scale down or up this image so it fits in the browser nicely, lets say 500px is safe
         $oldSize = $gd->getProperties($filePath);
         if ($oldSize['w'] >= $this->resizeWidth) {
             $newSize = $gd->getAspectRatio($oldSize['w'], $oldSize['h'], $this->resizeWidth, 0);
             $gd->resize($filePath, $newSize['w'], $newSize['h']);
         }
         echo json_encode($result);
         Yii::app()->end();
     } else {
         throw new CHttpException(Yii::t('zii', 'Invalid request'));
     }
 }
开发者ID:aakbar24,项目名称:CollegeCorner_Ver_2.0,代码行数:31,代码来源:TbUberUploadAction.php

示例10: actionUploadDocument

 public function actionUploadDocument($id)
 {
     $module_name = "";
     if (isset($_REQUEST['module_name'])) {
         $module_name = $_REQUEST['module_name'];
     }
     Yii::import("ext.EAjaxUpload.qqFileUploader");
     $folder = 'uploads/';
     // folder for uploaded files
     $allowedExtensions = array("jpeg", "jpg", "gif", "png", "pdf", "odt", "docx", "doc", "dia");
     //array("jpg","jpeg","gif","exe","mov" and etc...
     $sizeLimit = 2 * 1024 * 1024;
     // maximum file size in bytes
     $uploader = new qqFileUploader($allowedExtensions, $sizeLimit);
     $result = $uploader->handleUpload($folder, false);
     $return = htmlspecialchars(json_encode($result), ENT_NOQUOTES);
     $fileSize = filesize($folder . $result['filename']);
     //GETTING FILE SIZE
     $fileName = $result['filename'];
     //GETTING FILE NAME
     $documentModel = new LbDocument();
     $documentModel->addDocument($module_name, $id, $fileName);
     return $return;
     // it's array
 }
开发者ID:nhuhtlb,项目名称:linxbooks,代码行数:25,代码来源:DefaultController.php

示例11: upload

 public function upload($dir = null, $flag = null)
 {
     // max file size in bytes
     $size = Configure::read('AMU.filesizeMB');
     if (strlen($size) < 1) {
         $size = 4;
     }
     $relPath = Configure::read('AMU.directory');
     if (strlen($relPath) < 1) {
         $relPath = "files/" . $_SESSION['User']['company_id'];
     }
     $sizeLimit = $size * 1024 * 1024;
     $this->layout = "ajax";
     $directory = WWW_ROOT . DS . $relPath;
     if ($dir === null) {
         $this->set("result", "{\"error\":\"Upload controller was passed a null value.\"}");
         return;
     }
     // Replace underscores delimiter with slash
     $dir = str_replace("___", "/", $dir);
     // dir for saving in model
     $get_dir = $dir;
     $dir = $directory . DS . "{$dir}/";
     if (!file_exists($dir)) {
         mkdir($dir, 0777, true);
     }
     if ($flag == 1) {
         $allowedExtensions = array('xls', 'xlxs');
     }
     $uploader = new qqFileUploader($allowedExtensions, $sizeLimit);
     $result = $uploader->handleUpload($dir, FALSE, $flag);
     $this->set("result", htmlspecialchars(json_encode($result), ENT_NOQUOTES));
     $this->_upload_add($result['details']['filename'], $result['details']['ext'], $result['details']['message'], $get_dir);
 }
开发者ID:Techmentis,项目名称:flinkiso-lite,代码行数:34,代码来源:FileUploadsController.php

示例12: upload

 public function upload($dir = null)
 {
     // max file size in bytes
     $size = Configure::read('AMU.filesizeMB');
     if (strlen($size) < 1) {
         $size = 4;
     }
     $relPath = Configure::read('AMU.directory');
     if (strlen($relPath) < 1) {
         $relPath = "files";
     }
     $sizeLimit = $size * 1024 * 1024;
     $this->layout = "ajax";
     Configure::write('debug', 0);
     $directory = WWW_ROOT . DS . $relPath;
     if ($dir === null) {
         $this->set("result", "{\"error\":\"Upload controller was passed a null value.\"}");
         return;
     }
     // Replace underscores delimiter with slash
     $dir = str_replace("___", "/", $dir);
     $dir = $directory . DS . "{$dir}/";
     if (!file_exists($dir)) {
         mkdir($dir, 0777, true);
     }
     $uploader = new qqFileUploader($this->allowedExtensions, $sizeLimit);
     $result = $uploader->handleUpload($dir);
     $this->set("result", htmlspecialchars(json_encode($result), ENT_NOQUOTES));
 }
开发者ID:Numerico-Informatic-Systems-Pvt-Ltd,项目名称:asha,代码行数:29,代码来源:UploadsController.php

示例13: index

 public function index()
 {
     // list of valid extensions, ex. array("jpeg", "xml", "bmp")
     $allowedExtensions = array();
     // max file size in bytes
     $sizeLimit = 10 * 1024 * 1024;
     $uploader = new qqFileUploader($allowedExtensions, $sizeLimit);
     $multi_dir = '';
     if ($this->config->get('multiimageuploader_folder')) {
         $multi_dir = "data/";
         $multi_dir .= $this->config->get('multiimageuploader_folder');
         if (!is_dir(DIR_IMAGE . $multi_dir)) {
             mkdir(DIR_IMAGE . $multi_dir, 0777);
         }
     }
     if ($this->config->get('multiimageuploader_segment')) {
         if ($this->config->get('multiimageuploader_segment') == "date") {
             $multi_dir .= date("Y") . "/";
             if (!is_dir(DIR_IMAGE . $multi_dir)) {
                 mkdir(DIR_IMAGE . $multi_dir, 0777);
             }
             if (!is_dir(DIR_IMAGE . $multi_dir)) {
                 mkdir(DIR_IMAGE . $multi_dir, 0777);
             }
             $multi_dir .= date("m") . "/";
             if (!is_dir(DIR_IMAGE . $multi_dir)) {
                 mkdir(DIR_IMAGE . $multi_dir, 0777);
             }
         }
     }
     $result = $uploader->handleUpload(DIR_IMAGE, $multi_dir);
     // to pass data through iframe you will need to encode all html tags
     echo htmlspecialchars(json_encode($result), ENT_NOQUOTES);
 }
开发者ID:bgabor,项目名称:RenaniaOpencart,代码行数:34,代码来源:upload.php

示例14: 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

示例15: save_image

 public function save_image()
 {
     import('3rdparty.qquploader');
     if ($_GET['type'] == 'avatar') {
         $type = 'avatar';
     } else {
         if ($_GET['type'] == 'game') {
             $type = 'game';
         } else {
             if ($_GET['type'] == 'photo') {
                 $type = 'agent';
             } else {
                 exit("Bad type");
             }
         }
     }
     // list of valid extensions, ex. array("jpeg", "xml", "bmp")
     $allowedExtensions = array('jpeg', 'png', 'jpg');
     // max file size in bytes
     $sizeLimit = 1 * 1024 * 1024;
     $uploader = new \qqFileUploader($allowedExtensions, $sizeLimit);
     $result = $uploader->handleUpload("img/{$type}/", False, True);
     $file = "{$result['filename']}.{$result['ext']}";
     if ($type == 'avatar') {
         $this->thumb_image($file, 'avatar', 80);
     } else {
         if ($type == 'game') {
             $this->thumb_image($file, 'game', 120);
         }
     }
     // to pass data through iframe you will need to encode all html tags
     echo htmlspecialchars(json_encode($result), ENT_NOQUOTES);
 }
开发者ID:radiosilence,项目名称:trouble,代码行数:33,代码来源:put.php


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