Im very new to Zend Framework. Im just wondering how to verify that a given file is a valid image or not. I have did some validation by renaming a file from sample.php to something like sample.gif. It passes the image validation by using the below code. I just want to prevent such file not to upload.
Any help is highly appreciated.
$mainphoto->addValidator(‘SIZE’,TRUE, array(‘max’ => 10240000, ‘messages’ => array( Zend_Validate_File_Size::TOO_BIG => ‘The maximum permitted image file size is <b>%max%</b> - selected image file size is <b>%size%</b>.’)));
$mainphoto->setLabel(‘Photo (Allowed Formats - jpg,jpeg,png,gif)’);
$mainphoto->addValidator(‘MimeType’, true, array(‘image/gif’, ‘image/JPEG’, ‘image/png’, ‘image/jpg’));
Thanks in Advance,