Reputation: 589
I created a new local disk under /storage/app/uploads
in
Filesystems.php:
'uploads' => [
'driver' => 'local',
'root' => storage_path('app/uploads'),
],
Now when I try to download a zip file in an ajax request, my DownloadController
throws a:
Internal server error Status code 500
Any idea? I couldn't find the problem. Thanks in advance.
Code snippet of the DownloadController:
public function verify(Request $request, $hash)
{
// Some sql queries here
$headers = ["Content-Type"=>"application/zip"];
return $response()->download(storage_path()."/app/uploads/test.zip", "test.zip",$headers);
}
EDIT
I discovered that:
return Storage::disk('uploads')->download("test.zip","zip.zip");
will work when the call is not made in an ajax. I somehow have to get the ajax to get the file and download it
Upvotes: 0
Views: 1785
Reputation: 2951
You can have a look at the doc on how to download the files, you need to specify your storage driver and then call the download method:
return Storage::disk('uploads')->download('test.zip');
Upvotes: 1