简体   繁体   中英

Yii file upload is not validating the file type

When I upload a file it doesn't validate - it allows all types (it shouldn't), allows empty (it shouldn't as well) etc. Of course I included proper rules (I think) in my model.

It looks like fileField is not validating for some reason.

Please take a look at it if you can't find anything wrong.

Here is the code:

array('employeedetails_photo', 'EImageValidator',  'width' => 600, 'height' => 400, 'message' => 'Size error message'),

array('employeedetails_photo', 'file', 'allowEmpty'=>true, 'types'=>'jpg, gif, png', 'maxSize'=>409600,'tooLarge'=>'The file was larger than 400K. Please upload a smaller file.'),

yii中存在一些问题,使用jQuery进行图像类型验证,我遇到了同样的问题,但是我通过使用jQuery解决了它。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM