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 maximum size of a file up to a max of 2GB

integer|null
$_max= ''
Maximum filesize
If null, there is no maximum filesize

array
$_messageTemplates= 'array(
self::TOO_BIG => "Maximum allowed size for file '%value%' is '%max%' but '%size%' detected"'
array(
self::TOO_BIG => "Maximum allowed size for file '%value%' is '%max%' but '%size%' detected"
Details
array
$_messageVariables= 'array(
'min' => '_min''
array(
'min' => '_min'
Details
__construct(
integer|array $options
)
:
void
Sets validator options
If $options is a integer, it will be used as maximum filesize As Array is accepts the following keys: 'min': Minimum filesize 'max': Maximum filesize 'bytestring': Use bytestring or real size for messages
Name | Type | Description |
---|---|---|
$options | integer|array | Options for the adapter |

_fromByteString(
string $size
)
:
integer
Returns the unformatted size
Name | Type | Description |
---|---|---|
$size | string |
Type | Description |
---|---|
integer |

_throw(
string $file, string $errorType
)
:
false
Throws an error of the given type
Name | Type | Description |
---|---|---|
$file | string | |
$errorType | string |
Type | Description |
---|---|
false |

_toByteString(
integer $size
)
:
string
Returns the formatted size
Name | Type | Description |
---|---|---|
$size | integer |
Type | Description |
---|---|
string |

getMax(
bool $raw
=
false
)
:
integer|string
Returns the maximum filesize
Name | Type | Description |
---|---|---|
$raw | bool | Whether or not to force return of the raw value (defaults off) |
Type | Description |
---|---|
integer|string |

getMin(
bool $raw
=
false
)
:
integer|string
Returns the minimum filesize
Name | Type | Description |
---|---|---|
$raw | bool | Whether or not to force return of the raw value (defaults off) |
Type | Description |
---|---|
integer|string |

isValid(
string $value, array $file
=
null
)
:
boolean
Defined by Zend_Validate_Interface
Returns true if and only if the filesize of $value is at least min and not bigger than max (when max is not null).
Name | Type | Description |
---|---|---|
$value | string | Real file to check for size |
$file | array | File data from Zend_File_Transfer |
Type | Description |
---|---|
boolean |

setMax(
integer $max
)
:
\Zend_Validate_StringLength
Sets the maximum filesize
Name | Type | Description |
---|---|---|
$max | integer | The maximum filesize |
Type | Description |
---|---|
\Zend_Validate_StringLength | Provides a fluent interface |
Exception | Description |
---|---|
\Zend_Validate_Exception | When max is smaller than min |

setMin(
integer $min
)
:
\Zend_Validate_File_Size
Sets the minimum filesize
Name | Type | Description |
---|---|---|
$min | integer | The minimum filesize |
Type | Description |
---|---|
\Zend_Validate_File_Size | Provides a fluent interface |
Exception | Description |
---|---|
\Zend_Validate_Exception | When min is greater than max |

setUseByteString(
boolean $byteString
=
true
)
:
integer
Returns the minimum filesize
Name | Type | Description |
---|---|---|
$byteString | boolean | Use bytestring ? |
Type | Description |
---|---|
integer |