所以我正在使用 Laravel 5,我试图强制下载选定的文件,但没有任何反应。
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);
}
并且响应标头似乎没问题
Accept-Ranges: none
Cache-Control: public
Connection: Keep-Alive
Content-Disposition: attachment; filename="SIGNAL - Nadezdata.mp3"
Content-Length: 4205059
Content-Type: audio/mpeg
你知道出了什么问题吗?