I am trying to upload some pictures on my website, it seems to work because ls -ila command returns that :
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 :
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
I already apply a chmod -R 777 on the folder
CodePudding user response:
In the URL to refer to some file on public folder, don't put the public folder, the laravel path starts from this folder.
example.com/images/covers/d3QCvZT8DilZm7qQ5moHMJa1jeC.jpg