monstajamss's avatar

Image not Saving in Laravel Nginx Ubuntu Server

I just deployed my laravel project on Nginx Ubuntu Server but anytime i tried to upload image i get this error

2020-06-14 21:00:32] production.ERROR: fopen(/var/www/laravel/public/image/uploads/1.png): failed to open stream: Permission denied {"userId":1,"exception":"[object] (ErrorException(code: 0): fopen(/var/www/laravel/public/image/uploads/1.png): failed to open stream: Permission denied at /var/www/laravel/vendor/league/flysystem/src/Adapter/Local.php:157)

and also in my database i get this /tmp/phpuFp8xC

What am i doing wrong?

0 likes
3 replies
t0berius's avatar

Wrong permissions set on the public / upload folder.

Try using something like:

chown -R www-data:www-data /var/www/laravel/public
chown -R www-data:www-data /var/www/laravel/storage
monstajamss's avatar

@t0berius it works when i edit the post the image saves but does not save properly on new posts

monstajamss's avatar

Now i am getting this error

[2020-06-14 21:13:07] production.ERROR: URI must be a string or UriInterface (View: /var/www/laravel/resources/views/pages/welcome.blade.php) {"exception":"[object] (ErrorException(code: 0): URI must be a string or UriInterface (View: /var/www/laravel/resources/views/pages/welcome.blade.php) at /var/www/laravel/vendor/guzzlehttp/psr7/src/functions.php:62) ```

Please or to participate in this conversation.