【问题标题】:The mimetype of file 'jpg' could not been detected无法检测到文件“jpg”的 mimetype
【发布时间】:2011-05-12 07:18:44
【问题描述】:

我的页面中有一个表单。将图片上传到主机。

它在 localhost 中运行良好!但在主机中它显示了这个错误:

无法检测到文件“3-1.jpg”的 mimetype

我在本地和服务器中使用了相同的图片!

即使我使用此代码 $form->archivo->getMimeType() 测试了该 mimetype,它也向我展示了:

图像/JPEG

这是我的表单代码:

$pic = new Zend_Form_Element_File('pic');

        $pic -> setLabel('select picture')      
            ->addValidator('Count', false, 1)
            ->addValidator('Size', false, '1MB')
            ->addValidator('Extension', false, 'jpg,png,gif')
            ->setAttrib('enctype', 'multipart/form-data')
            ->addValidator('MimeType', false, array('image/jpeg',  'image/png', 'image/gif'))
            ->setDestination(PUBLIC_DIR . 'upload/product')
            ->addDecorators(array('HtmlTag', array('tag' => 'label','class'=> "descrip")), array('Label', array('tag' => 'label')));

【问题讨论】:

  • 不确定这是否有帮助,正如您所说的 mime 类型输出 image/jpeg,但 JPEG 也可能具有以下类型:image/pjpeg 和 image/jpg - 我会试一试。

标签: zend-framework file-upload mime-types


【解决方案1】:
猜你喜欢
  • 2014-04-26
  • 2013-12-23
  • 1970-01-01
  • 2012-05-15
  • 2011-06-02
  • 2011-04-14
  • 2016-06-08
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多