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


PHP qqFileUploader::getFileName方法代碼示例

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


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