[英]404 error on Laravel after uploading a file
I am trying to upload some pictures on my website, it seems to work because ls -ila command returns that:我正在尝试在我的网站上上传一些图片,它似乎有效,因为 ls -ila 命令返回:
156635331 -rwxrwxrwx 1 sc1vjfd9614 sc1vjfd9614 139194 3 août 19:07 4CBU96b0Ec7HHD7q7wt0T6MhPiK.jpg
156635332 -rwxrwxrwx 1 sc1vjfd9614 sc1vjfd9614 67877 3 août 19:07 9LxUUR5UnwST7y1XItgdORNevyy.jpg
Here is the PHP code:这是 PHP 代码:
if($posterFile = file_get_contents('https://example.com/t/p/original/'.$media['poster_path']))
{
file_put_contents('/home/server/website/site/public/images/covers/'.$media['poster_path'] .'' , file_get_contents('https://image.tmdb.org/t/p/original/'.$media['poster_path']));
}
And I got a 404 error when I go to https://www.example.com/public/images/covers/d3QCvZT8DilZm7qQ5moHMJa1jeC.jpg当我从 go 到https://www.example.com/public/images/covers/d3QCvZT8DilZm7qQ5moHMJa1jeC.jpg时出现 404 错误
I already apply a chmod -R 777 on the folder我已经在文件夹上应用了 chmod -R 777
In the URL to refer to some file on public folder, don't put the public folder, the laravel path starts from this folder.在URL中引用公用文件夹中的一些文件,不要放公用文件夹,laravel路径就是从这个文件夹开始的。
example.com/images/covers/d3QCvZT8DilZm7qQ5moHMJa1jeC.jpg example.com/images/covers/d3QCvZT8DilZm7qQ5moHMJa1jeC.jpg
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.