我在Symfony2项目中有一个文件上传功能,我想验证上传的文件是.tex文件格式=> LaTex文件.
对于text / html,我正在使用:
原文链接:https://www.f2er.com/php/136553.html对于text / html,我正在使用:
$Metadata->addPropertyConstraint('file',new Assert\File(array( 'maxSize' => '100000k','mimeTypes' => array("text/html"),'mimeTypesMessage' => 'Please upload a valid HTM/HTML File',)));
我在尝试:
$Metadata->addPropertyConstraint('file','mimeTypes' => array( 'text/html','application/x-tex','application/x-latex' ),'mimeTypesMessage' => 'Please upload a valid HTM/HTML/TEX File',)));
Please upload a valid HTM/HTML/TEX File.