671. Class

671.1. Zend\Validator\File\Size

Validator for the maximum size of a file up to a max of 2GB

671.1.1. Methods

671.1.1.1. __construct

__construct()

Sets validator options

If $options is a integer, it will be used as maximum file size As Array is accepts the following keys: ‘min’: Minimum file size ‘max’: Maximum file size ‘useByteString’: Use bytestring or real size for messages

Parameters:integer|array|Traversable – Options for the adapter

671.1.1.2. useByteString

useByteString()

Should messages return bytes as integer or as string in SI notation

Parameters:bool – Use bytestring ?
Return type:integer

671.1.1.3. getByteString

getByteString()

Will bytestring be used?

Return type:bool

671.1.1.4. getMin

getMin()

Returns the minimum file size

Parameters:bool – Whether or not to force return of the raw value (defaults off)
Return type:integer|string

671.1.1.5. setMin

setMin()

Sets the minimum file size

File size can be an integer or an byte string This includes ‘B’, ‘kB’, ‘MB’, ‘GB’, ‘TB’, ‘PB’, ‘EB’, ‘ZB’, ‘YB’ For example: 2000, 2MB, 0.2GB

Parameters:integer|string – The minimum file size
Return type:Size Provides a fluent interface
Throws :ExceptionInvalidArgumentException When min is greater than max

671.1.1.6. getMax

getMax()

Returns the maximum file size

Parameters:bool – Whether or not to force return of the raw value (defaults off)
Return type:integer|string

671.1.1.7. setMax

setMax()

Sets the maximum file size

File size can be an integer or an byte string This includes ‘B’, ‘kB’, ‘MB’, ‘GB’, ‘TB’, ‘PB’, ‘EB’, ‘ZB’, ‘YB’ For example: 2000, 2MB, 0.2GB

Parameters:integer|string – The maximum file size
Return type:Size Provides a fluent interface
Throws :ExceptionInvalidArgumentException When max is smaller than min

671.1.1.8. getSize

getSize()

Retrieve current detected file size

Return type:int

671.1.1.9. setSize

setSize()

Set current size

Parameters:int
Return type:Size

671.1.1.10. isValid

isValid()

Returns true if and only if the file size of $value is at least min and not bigger than max (when max is not null).

Parameters:string|array – File to check for size
Return type:bool

671.1.1.11. toByteString

toByteString()

Returns the formatted size

Parameters:integer
Return type:string

671.1.1.12. fromByteString

fromByteString()

Returns the unformatted size

Parameters:string
Return type:integer

671.1.2. Constants

671.1.2.1. TOO_BIG

@const string Error constants

671.1.2.2. TOO_SMALL

671.1.2.3. NOT_FOUND