FilamentF
Filament17mo ago
darrenm

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

->acceptedFileTypes([
    'image/vnd.microsoft.icon',
])


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 host
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)
Was this page helpful?