API Documentation

Validate/File/Size.php

Includes Classes 
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Validate
version
$Id: Size.php 22697 2010-07-26 21:14:47Z alexander $
Classes
Zend_Validate_File_Size

Description

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.

Zend_Validate_File_Size

Extends from
Zend_Validate_Abstract
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Validate
Constants
TOO_BIG
TOO_SMALL
NOT_FOUND
Properties
$_messageTemplates
$_messageVariables
$_min
$_max
$_size
$_useByteString
Methods
__construct
setUseByteString
useByteString
getMin
setMin
getMax
setMax
_getSize
_setSize
isValid
_toByteString
_fromByteString
_throw

Description

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

Constants

TOO_BIG

 TOO_BIG = 'fileSizeTooBig'

Details

value
fileSizeTooBig

TOO_SMALL

 TOO_SMALL = 'fileSizeTooSmall'

Details

value
fileSizeTooSmall

NOT_FOUND

 NOT_FOUND = 'fileSizeNotFound'

Details

value
fileSizeNotFound

Properties

$_max

integer|null $_max = ''

Maximum filesize

If null, there is no maximum filesize

Details

$_max
integer|null
visibility
protected
default
final
false
static
false

$_messageTemplates

array $_messageTemplates = 'array'

Details

$_messageTemplates
array
Error message templates
visibility
protected
default
array
final
false
static
false

$_messageVariables

array $_messageVariables = 'array'

Details

$_messageVariables
array
Error message template variables
visibility
protected
default
array
final
false
static
false

$_min

integer $_min = ''

Minimum filesize

Details

$_min
integer
visibility
protected
default
final
false
static
false

$_size

integer $_size = ''

Detected size

Details

$_size
integer
visibility
protected
default
final
false
static
false

$_useByteString

boolean $_useByteString = 'true'

Use bytestring ?

Details

$_useByteString
boolean
visibility
protected
default
true
final
false
static
false

Methods

__construct

__construct( integer|array $options ) :

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

Arguments
$options
integerarray
Options for the adapter
Details
visibility
public
final
false
static
false

_fromByteString

_fromByteString( string $size ) : integer

Returns the unformatted size

Arguments
$size
string
Output
integer
Details
visibility
protected
final
false
static
false

_getSize

_getSize( ) : int

Retrieve current detected file size

Output
int
Details
visibility
protected
final
false
static
false

_setSize

_setSize( int $size ) : Zend_Validate_File_Size

Set current size

Arguments
$size
int
Details
visibility
protected
final
false
static
false

_throw

_throw( string $file, string $errorType ) : false

Throws an error of the given type

Arguments
$file
string
$errorType
string
Output
false
Details
visibility
protected
final
false
static
false

_toByteString

_toByteString( integer $size ) : string

Returns the formatted size

Arguments
$size
integer
Output
string
Details
visibility
protected
final
false
static
false

getMax

getMax( bool $raw = false ) : integer|string

Returns the maximum filesize

Arguments
$raw
bool
Whether or not to force return of the raw value (defaults off)
Output
integer|string
Details
visibility
public
final
false
static
false

getMin

getMin( bool $raw = false ) : integer|string

Returns the minimum filesize

Arguments
$raw
bool
Whether or not to force return of the raw value (defaults off)
Output
integer|string
Details
visibility
public
final
false
static
false

isValid

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).

Arguments
$value
string
Real file to check for size
$file
array
File data from Zend_File_Transfer
Output
boolean
Details
visibility
public
final
false
static
false

setMax

setMax( integer $max ) : Zend_Validate_StringLength

Sets the maximum filesize

Arguments
$max
integer
The maximum filesize
Output
Zend_Validate_StringLength
Provides a fluent interface
Details
visibility
public
final
false
static
false
throws
When max is smaller than min

setMin

setMin( integer $min ) : Zend_Validate_File_Size

Sets the minimum filesize

Arguments
$min
integer
The minimum filesize
Output
Zend_Validate_File_Size
Provides a fluent interface
Details
visibility
public
final
false
static
false
throws
When min is greater than max

setUseByteString

setUseByteString( boolean $byteString = true ) : integer

Returns the minimum filesize

Arguments
$byteString
boolean
Use bytestring ?
Output
integer
Details
visibility
public
final
false
static
false

useByteString

useByteString( ) : boolean

Will bytestring be used?

Output
boolean
Details
visibility
public
final
false
static
false
Documentation was generated by DocBlox.