/**
  * Override parent
  */
 function handleFileUpload($fileParameters, $id)
 {
     $filename = NULL;
     if (array_key_exists($this->parameterFile, $_FILES) and array_key_exists('name', $_FILES[$this->parameterFile]) and $_FILES[$this->parameterFile]['name'] != '') {
         $fileHelper = new FileHelper();
         $filename = $fileHelper->upload($this->fileBasename, $id, $_FILES[$this->parameterFile]);
     }
     return $filename;
 }
Пример #2
0
 /**
  * 管理员上传
  */
 function actionIndex()
 {
     $name = $_REQUEST['field'];
     if (!$name) {
         exit;
     }
     $file = new FileHelper();
     $file->uid = Yii::app()->user->id;
     $file->admin = 1;
     $rt = $file->upload();
     if (!$rt) {
         return;
     }
     $new[] = $rt;
     $out = FileHelper::input($new, $name);
     echo $out;
     exit;
 }
 /**
  * Override parent
  */
 function handleFileUpload($fileParameters, $id)
 {
     $filename = NULL;
     if (array_key_exists($this->parameterFile, $_FILES) and array_key_exists('name', $_FILES[$this->parameterFile]) and $_FILES[$this->parameterFile]['name'] != '') {
         $fileHelper = new FileHelper();
         // hack pour pouvoir avoir la catégorie
         $filename = $this->fileBasename;
         /*if (isset($_POST["object_category"])) {
         			$category = $_POST["object_category"];
         			$filename = $category ."_".self::fileBasename;
         		}*/
         $filename = $fileHelper->upload($filename, $id, $_FILES[$this->parameterFile]);
     }
     return $filename;
 }
Пример #4
0
 /**
 	+++Method Helpers
 */
 private function uploadFiles($model, $modelName)
 {
     $attributes = $this->fileAttributes($model->edit);
     foreach ($attributes as $key => $attribute) {
         $name = InputFactory::getName($key, $attribute);
         $imagePath = FileHelper::upload($model, $modelName, $name, $attribute, true);
         if ($imagePath !== false) {
             $model->{$name} = $imagePath["fileName"];
         }
     }
     return $model;
 }