我有这样的元素:
意见:
<li><a href="{{route('front.download')}}" target="_blanck">Download PDF</a></li>主计长:
public function download(){
$document = Documents::first();
return response()->download(url('uploads/documents/'.$document->filename));
}我有个问题:
The file "http://127.0.0.1:8000/uploads/documents/1-1654548555.pdf" does not exist我检查了目录上传/文件和文件1-1654548555.pdf存在,有什么问题吗?
发布于 2022-06-07 12:58:37
试试这个。
/**
* download file
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Auth\Access\Response
*/
public function download(Request $request)
{
$file = public_path(). "uploads/documents/";
$headers = ['Content-Type: application/pdf'];
return \Response::download($file, 'test.pdf', $headers);
}https://stackoverflow.com/questions/72530859
复制相似问题