Answer the question
In order to leave comments, you need to log in
How to submit a file for download in laravel?
Good afternoon. I want to send a file for download, but I still get errors. I do something like this:
$path = 'public/path/to/file/filename.doc';
$storage = Storage::cloud();
$file = $storage->get($path);
return response()->download($file, 'your_file.doc');
is_file() expects parameter 1 to be a valid path, string given
return Response::download($file);
, also does not work. Answer the question
In order to leave comments, you need to log in
That type.
$path = Storage::disk('local')->path($path);
return response()->download($path, basename($path));
Response expects a file path, while Storage returns its contents.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question