FileUpload field validation passes on upload but fails on submit
Hello Filament people!
Working on my first project and have a curious problem with a
FileUpload
field.
I'm allowing upload of a favicon and am validating using
This works just fine for the upload task - so I believe the mime type is correct. When the form is submitted, it fails with a validation.mimetypes
error. Using a ->image()
validation works fine. Not sure what's going on here - I'd prefer to restrict to just .ico files.
filament forms v3.2.100, Ubuntu 2204/ PHP8.3 hostSolution:Jump to solution
yeah I've been thinking that might be the workaround. I can see a hint that it's getting turned into an octet stream during the submission process.
But I've got over it for now with
->rules(['extensions:ico,png'])
(although that doesn't work on the client side)...11 Replies
Can you provide the whole FileUpload Field.
Whats the full error? Does it say the mime type failure/where it was triggered?
try:
too
@darrenm Does the file get created in the
livewire-tmp
directory?It should do if memory serves me right
Yeah it should, just trying to see if its similar to my issue here: https://discord.com/channels/883083792112300104/1275513064086569022
yes
"The favicon field must be a file of type: image/vnd.microsoft.icon, image/x-icon"
Customise the validation rule and dump what the mime type is
@toeknee how would you dump the mime type in filament form?
Write a custom validation rule which handles it
Solution
yeah I've been thinking that might be the workaround. I can see a hint that it's getting turned into an octet stream during the submission process.
But I've got over it for now with
->rules(['extensions:ico,png'])
(although that doesn't work on the client side)