MIME 类型错误

MIME type error

对于 Cakephp 2.6,我有以下警告:

Can not determine the mimetype.

Error: An Internal Error Has Occurred.

下面是我的模型:

 'mimeType' => array(
            'rule' => array('mimeType', array('image/gif', 'image/png', 'image/jpg', 'image/jpeg')),
            'message' => 'Please only upload images (gif, png, jpg).',
            'allowEmpty' => FALSE,
            ),

在php.ini (\xampp\php\php.ini) 我取消注释

extension=php_fileinfo.dll 

但我仍然有同样的错误信息。

即使我的调试设置为 2,错误消息中也没有行号。唯一显示的错误消息是: Can not determine the mimetype.Error: An Internal Error Has Occurred。 对于堆栈跟踪,'Validation::mimeType(array, array)' 的值为

array(
'name' => '2009_Infini-jaune-2.jpg',
'type' => 'image/jpeg',
'tmp_name' => 'C:\xampp\tmp\phpEC6C.tmp',
'error' => (int) 0,
'size' => (int) 186994)

数组( (int) 0 => 'image/png', (int) 1 => 'image/jpeg' )`

启用或禁用扩展时,请务必重新启动网络服务器(或者 PHP 如果您是 运行 PHP 作为 FastCGI 实例)。

上将文本 ;extension=php_fileinfo.dll 更改为 extension=php_fileinfo.dll php.ini 这个对我有用。希望对大家有帮助。我正在使用 xampp.

之后不要忘记重新启动网络服务器。