How to use Zend_Validate_File_MimeType()?
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
精彩评论