Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.
Validator for the mime type of a file
FALSE_TYPE = 'fileMimeTypeFalse'
NOT_DETECTED = 'fileMimeTypeNotDetected'
NOT_READABLE = 'fileMimeTypeNotReadable'
resource $_finfo = ''
Finfo object to use
boolean $_headerCheck = 'false'
Option to allow header check
array $_magicFiles = 'array'
If no $_ENV['MAGIC'] is set, try and autodiscover it based on common locations
string|null $_magicfile = ''
Magicfile to use
array $_messageTemplates = 'array'
array $_messageVariables = 'array'
string|null $_mimetype = ''
Mimetypes
If null, there is no mimetype
string $_type = ''
__construct(
string|array $mimetype
)
:
void
Sets validator options
Mimetype to accept
_throw(
string $file, string $errorType
)
:
false
Throws an error of the given type
addMimeType(
string|array $mimetype
)
:
Zend_Validate_File_Extension
Adds the mimetypes
enableHeaderCheck(
$headerCheck
=
true
)
:
Zend_Validate_File_MimeType
Defines if the http header should be used Note that this is unsave and therefor the default value is false
getHeaderCheck(
)
:
boolean
Returns the Header Check option
getMagicFile(
)
:
string
Returns the actual set magicfile
getMimeType(
boolean $asArray
=
false
)
:
string|array
Returns the set mimetypes
isValid(
string $value, array $file
=
null
)
:
boolean
Defined by Zend_Validate_Interface
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.
setMagicFile(
string $file
)
:
Zend_Validate_File_MimeType
Sets the magicfile to use if null, the MAGIC constant from php is used if the MAGIC file is errorous, no file will be set
setMimeType(
string|array $mimetype
)
:
Zend_Validate_File_Extension
Sets the mimetypes