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


PHP upload::upload_process方法代碼示例

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


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

示例1: array

 function upload_pic($file = array(), $other = array())
 {
     if (!$file || !$other) {
         return false;
     }
     $upload = new upload("pic");
     $upload->out_file_dir = "./statics/images/idea";
     $upload->out_file_name = "idea" . time();
     $upload->upload_process();
     $error_no = $upload->error_no;
     if ($error_no > 0) {
         return flase;
     }
     $other["add_time"] = time();
     $other["location"] = trim($upload->saved_upload_name, ".");
     $other["belong_to"] = "idea";
     $rs = daocall("admin", "insert_pic", array($other));
     if (!$rs) {
         return false;
     }
     return true;
 }
開發者ID:im286er,項目名稱:hobby,代碼行數:22,代碼來源:admin.model.php

示例2: upload

 public function upload($field = 'file', $directoryExtend = '', $required = false, $resize = false, $watermark = '', $watermarkOver = 0, $watermarkPosition = '')
 {
     $file = '';
     if (isset($_FILES[$field]['name']) && strlen($_FILES[$field]['name']) > 3) {
         recursive_mkdir(DATA_SERVER_PATH . "/uploads/" . $this->uploadFileDirectory . $directoryExtend);
         $upload = new upload();
         $upload->upload_form_field = $field;
         $upload->out_file_dir = DATA_SERVER_PATH . "/uploads/" . $this->uploadFileDirectory . $directoryExtend;
         $upload->max_file_size = $this->maxFileSize;
         $upload->make_script_safe = 1;
         $upload->allowed_file_ext = $this->fileExt;
         $upload->upload_process();
         if ($upload->error_no) {
             switch ($upload->error_no) {
                 case 1:
                     // 無上傳
                     return "error_no_file_upload";
                     exit;
                 case 2:
                     // 無效的擴展名
                     return "error_invalid_file_ext";
                     exit;
                 case 3:
                     // 太大...
                     return "error_file_too_big";
                     exit;
                 case 4:
                     // 無法移動上傳的文件
                     return "error_no_file_upload";
                     exit;
             }
         }
         $file = substr($upload->saved_upload_name, strlen(DATA_SERVER_PATH . "/uploads/" . $this->uploadFileDirectory . $directoryExtend));
         $this->lastUploadedFile = $file;
         if ($resize) {
             $this->resizeImages($file, $directoryExtend, $watermark, $watermarkOver, $watermarkPosition);
         }
     } elseif ($required) {
         return 'error_file_not_set';
     }
     return $file;
 }
開發者ID:yunsite,項目名稱:demila,代碼行數:42,代碼來源:base.class.php


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