monstajamss's avatar

Image is saving as /tmp in laravel

I have configured my laravel server and my laravel root is /var/www/laravel but anytime i upload an image it shows as

/tmp/phptxLvZD

inside the database

how can i resolve this?

0 likes
6 replies
jlrdw's avatar

Can you show the code you have tried from the documentation. Does that folder have proper permissions, and what does your browser developer tools show.

monstajamss's avatar

@jlrdw it says this

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)

Then

[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) 
monstajamss's avatar

I have solved it

  1. I did not add aws details to .env on nginx server
  2. i did not add another package details .env on nginx server
jlrdw's avatar

Good. Glad you figured it out.

Snapey's avatar

file uploads always write first to a temporary file. Your job is to move that file to the place you want to keep it. Its all explained in the file uploads section of the docs

1 like

Please or to participate in this conversation.