php - Yii wrong detect mimType -


i have application in yii 1.1 , in cactiverecord model rule checking uploaded file's mimtype

'mimetypes'=>'jpg,jpeg,gif,png' 

but when upload jpg file give me error :

the file "picture003.jpg" cannot uploaded. files of these mime-types allowed: jpg, jpeg, gif, png. 

also tried :

'mimetypes'=>'image/jpg,image/jpeg,image/gif,image/png' 

and time error :

finfo_file(c:\xampp\tmp\phpd670.tmp): failed open stream: no such file or directory  

this correct 'mimetypes'=>'image/jpg,image/jpeg,image/gif,image/png', prevent next error

finfo_file(c:\xampp\tmp\phpd670.tmp): failed open stream: no such file or directory 

use file save after model save, cuase file deleted temporrary dir after save.

if ( $model->save() ) {    $model->image->saveas(/*path*/); } 

Comments