/** * Constructor. * * @param Application $app * @param string $formName * @param File $file */ public function __construct(Application $app, $formName, File $file) { $this->app = $app; $this->formName = $formName; $this->file = $file; $this->fullPath = (string) $file; $this->fileName = basename($this->fullPath); $this->valid = $file->isValid(); $this->config = $app[Extension::CONTAINER]->config; }
public function __construct(File $file = null) { $this->tmpDir = storage_path() . '/tmp/'; $this->storage = Storage::disk('s3'); if (!is_writable($this->tmpDir)) { throw new \Exception("{$this->tmpDir} is not writable"); } if ($file instanceof UploadedFile) { if ($file->isValid()) { $this->file = $file; } else { throw new \Exception("Uploaded file is not valid"); } } }