所以我正在使用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);
}
Run Code Online (Sandbox Code Playgroud)
并且响应头似乎没问题
Accept-Ranges: none
Cache-Control: public
Connection: Keep-Alive
Content-Disposition: attachment; filename="SIGNAL - Nadezdata.mp3"
Content-Length: 4205059
Content-Type: audio/mpeg
Run Code Online (Sandbox Code Playgroud)
你知道什么是错的吗?