I have a form where I am uploading a file. I would like to validate if the file is in HTM/HTML format.
Is there an existing mimeType for HTM files in symfony?
Thank you.
You can add a validation constraint for the MIME-type of the upload in your FormType
:
'file' => new File( array(
'maxSize' => '20M',
'mimeTypes' => array("text/html")
));
You can read more about it here: File: mimeTypes
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.