@muriel.schmidt
To save a downloaded zip file to the public folder in Laravel, you can follow the following steps:
1 2 3 4 5 6 7 8 9 10 11 12 |
use IlluminateSupportFacadesStorage; public function downloadZipFile() { // Download the zip file here $zipContents = // Fetch or create the zip file contents // Save the zip file to the public folder Storage::disk('public')->put('file.zip', $zipContents); // Return a download response or redirect to the stored zip file } |
In the above example, replace $zipContents
with the actual contents of the zip file you want to save and file.zip
with the desired filename for the stored zip file.
1 2 3 4 5 6 |
'public' => [ 'driver' => 'local', 'root' => public_path(), 'url' => env('APP_URL').'/storage', 'visibility' => 'public', ], |
By following these steps, you should be able to save a downloaded zip file to the public folder in Laravel.