Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cakephp image -Can not determine the mimetype

cakephp 2.3

I'm uploading an image and I have an error saying that:

Can not determine the mimetype.

Error: An Internal Error Has Occurred.

On my Model this is a part of my $validation

'file_name' => array(
            'uploadError' => array(
                'rule' =>'uploadError',
                'message' => 'Your image upload failed',
                'allowEmpty' => FALSE,
                //'required' => false,
                //'last' => false, // Stop validation after this rule
                //'on' => 'create', // Limit validation to 'create' or 'update' operations
            ),
            'mimeType' => array(
                'rule' => array('mimeType', array('image/gif', 'image/png', 'image/jpg', 'image/jpeg')),
                'message' => 'Please only upload images (gif, png, jpg).',
                'allowEmpty' => FALSE,
                ),
            'fileSize' => array(
                'rule' => array('fileSize', '<=', '2MB'),
                'message' => 'Your image must be less than 2MB or(2048ko).',
                'allowEmpty' => FALSE,
                ),
            'processCoverUpload' => array(
                'rule' => 'processCoverUpload',
                'message' => 'Unable to process cover image upload.',
                'allowEmpty' => FALSE,
                ),
            'unique' => array(
                'rule' => 'isUnique',
                'message' => 'This file name is already exist in your folder',
                'required' => 'create',
                'allowEmpty' => FALSE,
                ),
        ),

I'm only allow 3 types of mimetype. any help?

like image 571
Papouche Guinslyzinho Avatar asked Dec 25 '13 07:12

Papouche Guinslyzinho


1 Answers

I just ran into exactly the same problem. Thanx to some other comments which pointed me in the right direction, here is my solution: Edit php.ini (\xampp\php\php.ini on Win7) search for extension=php_fileinfo.dll and uncomment it.

FYI: I'm running xampp 1.7.7 [Apache:2.2.21; PHP:5.3.8; MySQL:5.5.16]. Hopefully on newer xampp versions the extension is enabled by default.

like image 118
Phaze Phusion Avatar answered Sep 23 '22 01:09

Phaze Phusion