Upload_Validator
class Upload_Validator
Config options
default_max_file_size | array | Contains a list of the max file sizes shared by all upload fields. This is then duplicated into the "allowedMaxFileSize" instance property on construct. |
Properties
array | $allowedMaxFileSize | Restrict filesize for either all filetypes or a specific extension, with extension-name as array-key and the size-restriction in bytes as array-value. | |
array | $allowedExtensions |
Methods
Return all errors that occurred while validating the temporary file.
Clear out all errors
Set information about temporary file produced by PHP.
Get maximum file size for all or specified file extension.
Set filesize maximums (in bytes or INI format).
No description
Limit allowed file extensions. Empty by default, allowing all extensions.
Determines if the bytesize of an uploaded file is valid - can be defined on an extension-by-extension basis in {@link $allowedMaxFileSize}
Determines if the temporary file has a valid extension An empty string in the validation map indicates files without an extension.
Run through the rules for this validator checking against the temporary file set by {@link setTmpFile()} to see if the file is deemed valid or not.
Details
at line 368
array
getErrors()
Return all errors that occurred while validating the temporary file.
at line 375
clearErrors()
Clear out all errors
at line 383
setTmpFile(array $tmpFile)
Set information about temporary file produced by PHP.
at line 393
int
getAllowedMaxFileSize(string $ext = null)
Get maximum file size for all or specified file extension.
at line 436
setAllowedMaxFileSize(array|int $rules)
Set filesize maximums (in bytes or INI format).
Automatically converts extensions to lowercase for easier matching.
Example:
array('*' => 200, 'jpg' => 1000, '[doc]' => '5m')
at line 464
array
getAllowedExtensions()
at line 477
setAllowedExtensions(array $rules)
Limit allowed file extensions. Empty by default, allowing all extensions.
To allow files without an extension, use an empty string. See {@link File::$allowed_extensions} to get a good standard set of extensions that are typically not harmful in a webserver context. See {@link setAllowedMaxFileSize()} to limit file size by extension.
at line 493
boolean
isValidSize()
Determines if the bytesize of an uploaded file is valid - can be defined on an extension-by-extension basis in {@link $allowedMaxFileSize}
at line 505
boolean
isValidExtension()
Determines if the temporary file has a valid extension An empty string in the validation map indicates files without an extension.
at line 524
boolean
validate()
Run through the rules for this validator checking against the temporary file set by {@link setTmpFile()} to see if the file is deemed valid or not.