So i'm using Laravel 5 and I tried to force download a 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 seem to be ok
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's wrong?