Reputation: 111
Before using the s3 driver, I did it like this
return response()->download(storage_path($path_to_file), $filename)->deleteFileAfterSend(true);
But now I don't know how to delete the file after downloading
return Storage::disk('s3')->get($path_to_file);
Upvotes: 1
Views: 1848
Reputation: 146
You might download the file then delete it!
//download the file
Storage::disk('s3')->get($file);
// delete it I prefer to make job for that
Storage::disk('s3')->delete($file);
Upvotes: 2
Reputation: 3440
$file = Storage::disk('s3')->get($path_to_file);
Storage::disk('s3')->delete($path_to_file);
return $file;
Not sure if its possible to chain a delete, could give it a go.
Upvotes: 3