FileUpload 401 (Unauthorized)
When I am trying to save an image I get "Error during upload" with "The data.field.image_id failed to upload."
I have Laravel installed on a path that is "domian.com/backend". So far everything else works fine.
What is wrong? How can I fix this? Thank you for all your help!
14 Replies
Are you on shared hosting?
Seems like a permission issue on the server for the tmp-livewire directory in storage.
No, Digitsl ocean own droplet...
Hmm. Still feels like a directory permissions issue to me.
Permissions look ok.
What are the permissions for storage/tmp-livewire
It could be that you need to create the directory too. Your server might not be able to create it if it doesn’t exist.
I would expect it all to be fine using forge though.
Definitely I server config issue though, but surprised since you’re using forge.
There is no such folder. I'll try to make one and tets again in the morning. Thank you for now, I'll let you know how that works.
The folder
storage/app/livewire-tmp
is never created. Evan if I add a folder error is exactly the same. So I would guess that the path before the livewire-tmp
is not getting passed correctly.
As I mentioned earlier I have a base URL on path example.com/backend
and I had problems with routing before so I had to add code from the screenshot to routes/web.php
where app.be_path='backend'
:
Is it possible that another route is needed for saving to livewire-tmp
Do some research on server config for running laravel in a subdirectory. I think that will solve all your problems. Then you won’t need to worry about any of the routing.
I have found a solution how to setup the NGINX server for Laravel to work in a subfolder. Thank you again for your guidance.
https://codewithsusan.com/notes/run-laravel-from-subdirectory-on-nginx
Hi!
The exact same thing happened to me in a production environment.
Could you please help me
Hi,
the problem is that livewire.js is loaded from the wrong location. Our solution was to write a redirect on the NGNIX config file to cath livewire.js and load it from the right path. We did it like this:
This is inserted right after defining the root folder, certificates, headers, and index.
I hope you can solve your problem with this.
In Laravel 11, this worked with me