Mar 4, 2022
6
Level 2
Download zip files
I'm trying to download a zip file I uploaded to my Laravel project in the path storage/app/zips/... but whenever I try to download the file the page freezes, gets slow and instead brings me a modal with symbols and weird characters loaded on it, yet I expect to see the file downloading in the browser. When I try to dump the existence of the file with dd(Storage::disk('local')->exists($file_url)), I also get the result false yet the file exists and the path is correct.
$file_url = Storage::path($task->file_url); //* path: path/to/laravel_project/storage/app/zips/file.zip
This is the download code:
public function download(Task $task)
{
$file_url = Storage::path($task->file_url);
return response()->download($file_url, $task->task_name);
}
I can't see the fault. Or is there a special way to download zip files?
Please or to participate in this conversation.