boltforms
boltforms copied to clipboard
Limit document file upload type
I am trying to specify only .doc, .docx, and .pdf as file uploads and cant seem to find anything on how specify those constraints
I would also like this :)
Since BoltForms will load in any of the default Symfony validator constraints you should be able to do this something like:
fields:
upload:
type: file
options:
required: true
label: Your Upload
constraints:
- File:
mimeTypes: ["application/pdf", "image/jpg", "image.png"]
All of the options outlined in the symfony docs: https://symfony.com/doc/current/reference/constraints/File.html#mimetypes
Should apply since the options you configure are passed straight to the validator.