I am trying to upload a file to a temporary location with the Laravel Storage Facade and it says that the file does not exist. I am trying to upload a file to a file. / storage / app / roofing / projects / {id} / then. Not sure where exactly I'm wrong.
foreach ($files as $file) { $path = Storage::putFile('contract-assets', new File('../storage/app/roofing/projects/'. $project->id.'/'. $file)); }
I need to send the file after saving to my local AWS S3 server because of the time it takes to try to upload directly to S3, and in my case this time because of the number of files that need to be saved. At the moment, everything that I will return is true in my dd (). What could be the reason for this?
if (!empty($request->contract_asset)) { $files = $request->file('contract_asset'); foreach ($files as $file) { Storage::putFile(Carbon::now()->toDateString().'/roofing/projects/'. $project->id.'/contract-assets', $file); } } foreach (Storage::files(Carbon::now()->toDateString().'/roofing/projects/'.$project->id.'/contract-assets') as $file) { dispatch(new ProcessRoofingProjectContractAssets($file, $project)); }
My job file.
public function handle() { $path = Storage::disk('s3')->put('contract-assets', $this->asset, 'public'); dd($path); $this->project->addContractAsset($path); }
UPDATE:
These are my current changes and I get the following error message. Failed because Unable to JSON encode payload. Error code: 5
foreach ($files as $file) { $returnedStoredFile = Storage::putFile('/roofing/projects/' . $project->id . '/contract-assets/'.Carbon::now()->toDateString(), $file); dispatch(new ProcessRoofingProjectContractAssets(Storage::get($returnedStoredFile), $project)); }
laravel laravel-5
user3732216
source share