FileUpload Not storing to DB
I've setup a file upload called 'avatar', the image seems to upload fine as inside my docker container, inside my path in storage/ I can view (although it saves as a .webp extension instead of the .jpg I uploaded?
But the url should store into my DB correct? It wont save and not sure what im missing.
14 Replies
Did you make the avatar fillable in the model ?
That may actually be a fair point... bare with
I forgot, its always the simple things π€£
Just now need a way to store the full URL rather than just the path/filename
This is so true π«
Friday brain is kicking in
The image stores like this for some reason, is there a way to strip the tags so it stores as
Want to remove the " and the \ slashes
I'm not sure about that, maybe some config on the drive? Or docker things
Idk if its some encoding done by the file upload process. Just tryna trace through the codebase
Good luck π
Found it, I was dumb
For context, when I was following the docs, I had avatar cast as an array, which was causing the URL issue
Actually want to re-open this.
When using the FileUpload. On the edit page, should the image be pre-populated? As based on my custom logic, a null value will remove the image, as I want the option for a user to be able to remove an image, but also keep the same one if its unchanged
I get no preview when I go to edit a record, so not sure if its supposed to?
@Jamie Cee how about the app url in your env file? In my case when I edit something with an image, the old one will be previewed and I can remove it.
I usually change it to the url I access, since I'm using laragon I change it to mydomain.test
Oh I changed it from localhost to
Try edit and see what's the path for the image.
But then thats gonna supply a URL to something that doesn't exist, no?
It shows correctly in the table view:
Just not in the upload block in the form