So, I am using Laravel 5, and I tried to force download the selected file, but nothing happens.
public function downloadUserFile(){ $result = $_POST['filename']; $entry = File::where('filename', $result)->firstOrFail(); $file = Storage::disk()->get($entry->filePath); $headers = array('Content-Type' => $entry->mimetype); return response()->download(storage_path($entry->filePath), $result, $headers); }
and the response headers look fine
Accept-Ranges: none Cache-Control: public Connection: Keep-Alive Content-Disposition: attachment; filename="SIGNAL - Nadezdata.mp3" Content-Length: 4205059 Content-Type: audio/mpeg
Do you know what is wrong?
source share