예제 #1
0
 public function fillFileUpload(IFileUpload $fileUpload)
 {
     $this->name = $fileUpload->getName();
     $this->size = $fileUpload->getSize();
     $this->content_type = $fileUpload->getContentType();
     $this->is_image = $fileUpload->isImage();
     if (is_null($this->UID)) {
         $this->generateUID();
     }
     $fullPath = $this->storage_path . DIRECTORY_SEPARATOR . $this->UID;
     $fileUpload->moveTo($fullPath);
     $this->full_path = $fullPath;
 }
예제 #2
0
 /**
  * Save uploaded file into database and on disk
  *
  * @param IFileUpload $uploadedFile
  * @return mixed
  */
 public function saveUploaded(IFileUpload $uploadedFile)
 {
     if ($uploadedFile->isImage()) {
         $file = self::imageObjectBuilder();
     } else {
         $file = self::fileObjectBuilder();
     }
     /** @var IFile $file */
     $file->fillFileUpload($uploadedFile);
     $this->databaseStorage->store($file);
     return $file;
 }