Validator for the mime type of a file
Sets validator options
Mimetype to accept - NULL means default PHP usage by using the environment variable ‘magic’ - FALSE means disabling searching for mimetype, should be used for PHP 5.3 - A string is the mimetype file to use
Parameters: | string|array|Traversable – |
---|
Sets the magicfile to use if null, the MAGIC constant from php is used if the MAGIC file is erroneous, no file will be set if false, the default MAGIC file from PHP will be used
Parameters: | string – |
---|---|
Return type: | MimeType Provides fluid interface |
Throws : | ExceptionRuntimeException When finfo can not read the magicfile |
Throws : | ExceptionInvalidArgumentException |
Throws : | ExceptionInvalidMagicMimeFileException |
Disables usage of MagicFile
Parameters: | $disable – False disables usage of magic file |
---|---|
Return type: | MimeType Provides fluid interface |
Is usage of MagicFile disabled?
Return type: | bool |
---|
Defines if the http header should be used Note that this is unsafe and therefor the default value is false
Parameters: | bool – |
---|---|
Return type: | MimeType Provides fluid interface |
Returns the set mimetypes
Parameters: | bool – Returns the values as array, when false a concatenated string is returned |
---|---|
Return type: | string|array |
Sets the mimetypes
Parameters: | string|array – The mimetypes to validate |
---|---|
Return type: | MimeType Provides a fluent interface |
Adds the mimetypes
Parameters: | string|array – The mimetypes to add for validation |
---|---|
Return type: | MimeType Provides a fluent interface |
Throws : | ExceptionInvalidArgumentException |
Defined by ZendValidatorValidatorInterface
Returns true if the mimetype of the file matches the given ones. Also parts of mimetypes can be checked. If you give for example “image” all image mime types will be accepted like “image/gif”, “image/jpeg” and so on.
Parameters: | string|array – Real file to check for mimetype |
---|---|
Return type: | bool |