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!
![No description](https://cdn.answeroverflow.com/1260365688355291226/Screenshot_2024-07-10_at_00.35.25.png)
![No description](https://cdn.answeroverflow.com/1260365688602890384/Screenshot_2024-07-10_at_00.35.44.png)
![No description](https://cdn.answeroverflow.com/1260365688799760434/Screenshot_2024-07-10_at_00.36.06.png)
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.
![No description](https://cdn.answeroverflow.com/1260368894582067251/Screenshot_2024-07-10_at_00.55.02.png)
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
![No description](https://cdn.answeroverflow.com/1260478855018450964/Shot_20240710_081056.png)
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.
![No description](https://cdn.answeroverflow.com/1271213885269086348/image.png)
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