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


PHP qqFileUploader::getFilePath方法代码示例

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


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

示例1: validateDocShare

 public static function validateDocShare(&$docshare)
 {
     $definition = array('name' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'desc' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'Active' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'));
     $form = new ezcInputForm(INPUT_POST, $definition);
     $Errors = array();
     if (!$form->hasValidData('name') || $form->name == '') {
         $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('faq/view', 'Please enter name!');
     } else {
         $docshare->name = $form->name;
     }
     if ($form->hasValidData('desc') && $form->desc != '') {
         $docshare->desc = $form->desc;
     } else {
         $docshare->desc = '';
     }
     if ($form->hasValidData('Active') && $form->Active == true) {
         $docshare->active = 1;
     } else {
         $docshare->active = 0;
     }
     if (empty($Errors)) {
         if (isset($_FILES["qqfile"]) && is_uploaded_file($_FILES["qqfile"]["tmp_name"]) && $_FILES["qqfile"]["error"] == 0) {
             $objectData = erLhcoreClassModelChatConfig::fetch('doc_sharer');
             $dataDocSharer = (array) $objectData->data;
             $allowedExtensions = explode(',', $dataDocSharer['supported_extension']);
             // max file size in bytes
             $sizeLimit = $dataDocSharer['max_file_size'] * 1024 * 1024;
             $uploader = new qqFileUploader($allowedExtensions, $sizeLimit);
             $result = $uploader->handleUpload('var/tmpfiles/');
             if (isset($result['success']) && $result['success'] == 'true') {
                 $result['filepath'] = $uploader->getFilePath();
                 $result['filename'] = $uploader->getFileName();
                 $result['filename_user'] = $uploader->getUserFileName();
                 $docshare->type = $uploader->getMimeType();
                 if ($docshare->id == null) {
                     $docshare->saveThis();
                 }
                 $docshare->removeFile();
                 $photoDir = 'var/storagedocshare/' . date('Y') . 'y/' . date('m') . '/' . date('d') . '/' . $docshare->id;
                 $photoDirPhoto = 'storagedocshare/' . date('Y') . 'y/' . date('m') . '/' . date('d') . '/' . $docshare->id . '/';
                 erLhcoreClassFileUpload::mkdirRecursive($photoDir);
                 $fileName = sha1(sha1($result['filepath']) . time()) . $uploader->getFileExtension();
                 $photoDir .= '/' . $fileName;
                 rename($result['filepath'], $photoDir);
                 $docshare->file_name = $fileName;
                 $docshare->file_path = $photoDirPhoto;
                 $docshare->file_name_upload = $result['filename_user'];
                 $docshare->file_size = $uploader->getFileSize();
                 $docshare->converted = 0;
                 $docshare->pdf_to_img_converted = 0;
                 $docshare->pages_pdf_count = 0;
                 $docshare->ext = $uploader->getFileExtension();
                 $docshare->saveThis();
             } elseif ($docshare->id == null) {
                 $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('faq/view', $result['error']);
             }
         } elseif ($docshare->id == null) {
             $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('faq/view', 'Please choose a file');
         }
     }
     return $Errors;
 }
开发者ID:sudogitguy,项目名称:livehelperchat,代码行数:62,代码来源:lhdocshare.php


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