Definition at line 35 of file ExcludeMimeType.php.
◆ isValid()
isValid |
( |
|
$value, |
|
|
|
$file = null |
|
) |
| |
Defined by Zend_Validate_Interface
Returns true if the mimetype of the file does not matche the given ones. Also parts of mimetypes can be checked. If you give for example "image" all image mime types will not be accepted like "image/gif", "image/jpeg" and so on.
- Parameters
-
- Returns
- boolean
Definition at line 61 of file ExcludeMimeType.php.
71 #require_once 'Zend/Loader.php'; 73 return $this->
_throw($file, self::NOT_READABLE);
78 if (empty($this->_type) && $this->_headerCheck) {
79 $this->_type = $file[
'type'];
82 if (empty($this->_type)) {
83 return $this->
_throw($file, self::NOT_DETECTED);
87 if (in_array($this->_type, $mimetype)) {
88 return $this->
_throw($file, self::FALSE_TYPE);
91 $types = explode(
'/', $this->_type);
92 $types = array_merge($types, explode(
'-', $this->_type));
93 foreach($mimetype as $mime) {
94 if (in_array($mime, $types)) {
95 return $this->
_throw($file, self::FALSE_TYPE);
_throw($file, $errorType)
static isReadable($filename)
getMimeType($asArray=false)
◆ $_messageTemplates
Initial value:= array(
self::FALSE_TYPE => "File '%value%' has a false mimetype of '%type%'",
self::NOT_DETECTED => "The mimetype of file '%value%' could not be detected",
self::NOT_READABLE => "File '%value%' is not readable or does not exist",
)
Definition at line 44 of file ExcludeMimeType.php.
◆ FALSE_TYPE
const FALSE_TYPE = 'fileExcludeMimeTypeFalse' |
◆ NOT_DETECTED
const NOT_DETECTED = 'fileExcludeMimeTypeNotDetected' |
◆ NOT_READABLE
const NOT_READABLE = 'fileExcludeMimeTypeNotReadable' |
The documentation for this class was generated from the following file: