开发者

How to use Zend_Validate_File_MimeType()?

开发者 https://www.devze.com 2023-01-12 06:03 出处:网络
I´m trying to use the zend mime validator and I´m doing this: $mime = array(\'image/jpeg\',\'image/gif\');

I´m trying to use the zend mime validator and I´m doing this:

$mime = array('image/jpeg','image/gif');
$valid = new Zend_Validate_File_MimeType($mime);
if ($valid->isValid($_FILES['file']['name']){
// do some stuff
}
开发者_开发问答

But it not working, the documentation is weak, how can I use it??! THanks and best regard´s!


Use $valid->getMessages() to find out what happened

if ($valid->isValid($_FILES['file']['name']){
// do some stuff
} else {
$messages = $valid->getMessages();
print_r($messages);
}
//do the normal stuff
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号