How to use FileUpload to simply upload a file...? 🤔
I have a
Image
resource that has a few basic attributes: filename, disk, directory, size, height, and width.
I also have an ImageResource
Filament resource class for the Image
model.
I want to use FileUpload
to create new Image
models, but I feel like I'm missing something.
At the moment, the form is simply one FileUpload
component and there's a Select
component that allows the user to select an existing directory or create a new one.
The idea is that when the user uploads a file and selects a directory, then a new Image
will be created and the file will now reside in the specified directory in our s3 bucket.
I have hard-coded the disk and am preserving the filename. Everything appears to work correctly when I choose a file, select a directory, and then hit Create....except, I can't find the file in our s3 bucket.
I can see the image in my storage/app/livewire-tmp
folder, but this is not supposed to be its final home.
Everything appears to be successful, but in the end I can't find the image file anywhere. 😢3 Replies
On a related note, can I use the Spatie Media Library to simply upload/manage images without having to associate them to models...? It doesn't look that way, but I just read something that seems to suggest that, perhaps, it's possible...? 🤔
No, that’s not possible with spatie’s package. The entire thing is based on polymorphic relationships.
It’s the package’s blessing and it’s curse.
Thx for confirming my initial thoughts...and dashing the little glimmer of hope I had...! 😜