예제 #1
0
 /**
  * @param  UploadedFile $file
  * @return mixed
  */
 public function store(UploadedFile $file)
 {
     $savedFile = $this->file->createFromFile($file);
     $path = $this->getDestinationPath($savedFile->getOriginal('path'));
     $stream = fopen($file->getRealPath(), 'r+');
     $this->filesystem->disk($this->getConfiguredFilesystem())->writeStream($path, $stream, ['visibility' => 'public', 'mimetype' => $savedFile->mimetype]);
     $this->createThumbnails($savedFile);
     return $savedFile;
 }
예제 #2
0
 /**
  * @param  UploadedFile $file
  * @return mixed
  */
 public function store(UploadedFile $file)
 {
     // Save the file info to db
     try {
         $savedFile = $this->file->createFromFile($file);
     } catch (\InvalidArgumentException $e) {
         return $e->getMessage();
     }
     // Move the uploaded file to files path
     $file->move(public_path() . $this->config->get('asgard.media.config.files-path'), $savedFile->filename);
     @chmod(public_path() . $this->config->get('asgard.media.config.files-path') . $savedFile->filename, 0666);
     $this->createThumbnails($savedFile);
     return $savedFile;
 }