FileUpload on a custom page won't work as expect ...
I'm trying to save just one image , but that save in an array; Don't know why. Trying to save that manually and it's always failed. So does that FileUpload work on a custom page ?
If yes, let me know how ...
11 Replies
What codes have you tried? And yes FileUpload works in custom page but it still has to be part of a filament form.
Just same as the doc
i try, minFiles, etc ...
and same when delete the file, nothing happen lol
Ok. Well the custom page is just a raw livewire component so you need to follow all the steps in adding a form to a livewire component. https://filamentphp.com/docs/3.x/forms/adding-a-form-to-a-livewire-component
ok, let's try that
humm, my page is extends Page
Yep. And if you track that back it extend Livewire/Component
All pages in filament are livewire components.
yes, i knew it. It 's why i tell to show me if you have an exemple of that. this look like a bug in page
There’s no bug in page. Did you add
$this->form->fill()
in the mount method?
I need to see whole code to help more. Just showing the FileUpload doesn’t help much.yes, it 's just for an update page form. all work very well, since i decided to add the uploadField
manually, it's save. but if i try to remove that image, it's remove only on the component, not the file. Maybe i need to did it myself ?
Yea. Removing the file in the form only removes it from the record. It’s not going to actually delete the file in storage. You would need an observer or delete it manually during the save process.
Thank fully for your timeshare 👍
O_O , i saw my mistake on updating , just need to update the data with $this->form->getState(), not $this->data. Oh my bad ...
That’s why seeing the whole code helps. Glad you figured it out.