[英]cant download files in laravel in production
i am trying to download a file in laravel.我正在尝试在 Laravel 中下载文件。 It works fine in localhost but not in production.
它在 localhost 中工作正常,但在生产中不工作。 The file path is ok.
文件路径没问题。 but the problem is when i am trying to download it.
但问题是当我尝试下载它时。 It gives an error saying the file doesnt exist.
它给出了一个错误,说该文件不存在。 Below is my code.
下面是我的代码。 please help.
请帮忙。 thanks in advance
提前致谢
public function getGo(Request $request){
$file=asset('storage/source/hey.png');
return response()->file($file);
}
Can you try the below code?.你可以试试下面的代码吗? I think below code would be helpful.
我认为下面的代码会有所帮助。
public function getGo(Request $request){
$file=storage_path('source/hey.png');
return response()->file($file);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.