S3 File Uploads
Guys, what am I missing? My S3 storage driver works fine in laravel, but when using FileUpload as per:
Nothing is uploaded to S3 and instead stays in the Livewire Tmp Dir. Why...
Solution:Jump to solution
make sure youre using getState() and not manually accessing the data from Livewire
10 Replies
Also after saving? Did you try removing
directory()
?After Saving we get a data array of:
Tried without directory and no different
That's weird. Why is the disk even in there?
I suspect it's becasue I'm not casting to array on the model. But I can't as it's a form build and one level deep i.e. ["data"]["documents"]["cv"]
Starting to think I need to write my own save function for file uploads. which isn't a huge deal, but thought that was why we use Filepond to handle all that and just return the path for where it has been uploaded too?
I am on a custom livewire component, so looks like I'll just look to handle the saving myself I suppose
This works
But seems far to hacky
@Dan Harrin sorry for the tag.. but running out of ideas and docs are slim on this one :/...
Is the fileupload in a custom livewire component requiring us to manually save? Or implement an additional trait? Or do we need to run a custom function which is monitored to handle the file uploads?
nope it should not require you to manually save
Solution
make sure youre using getState() and not manually accessing the data from Livewire
getState() is the thing that validates and stores files and saves relationships
This is likely why! Thanks Dan, will double check it. I think I maybe using raw data from when I was storing for a resume function later
please follow the "adding a form to a livewire component" docs ;)
Bahaha tbf I added this ages ago, it’s just a slip of duplicating a function. Sorry Dan 🙈
Yep just remoted in and checked... I was validating it but then just returning $this->data :/ ffs.
$this->getState does render the correct links etc Thanks a Bunch Dan, only wasted 3/4 of a day on it haha