Zend_Form - The mimetype of file 'foto.jpg' could not be detected

牧云@^-^@ 提交于 2019-12-03 14:58:57

same thing happened to me, this was crazy stuff, more than 2 hours trying to figure out what's wrong, here is how to fix it:

install fileinfo extension on linux:

pecl install fileinfo

then you need to add to your php.ini this line:

extension=fileinfo.so

restart your apache and you are done!

*if you server is freeBSD you have to do this:

cd /usr/ports/sysutils/pecl-fileinfo/ make install

If you are using XAMPP and localhost just open your php.ini file and uncomment:

extension=php_fileinfo.dll

From the comments in the ZF Reference Guide:

In order to make IsImage working (and maybe all other mime related validators) on Zend Server on win32 I had to replace "magic.mime" supplied on Zend Server ("\etc") by the one on Apache ("\conf" , file is called "magic") (don't forget to restart Apache).

If it still doesn't work then you could try with these alternatives:

  • $element->addValidator('Mimetype', false, 'image/jpg');

or

  • $element->addValidator('Extension', false, 'jpg');
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!