Class Zend_Validate_File_Size

Description

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

  • copyright: Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  • license: New BSD License

Located in /Validate/File/Size.php (line 35)

Zend_Validate_Abstract
   |
   --Zend_Validate_File_Size
Direct descendents
Class Description
 class Zend_Validate_File_FilesSize Validator for the size of all files which will be validated in sum
Class Constant Summary
 NOT_FOUND = 'fileSizeNotFound'
 TOO_BIG = 'fileSizeTooBig'
 TOO_SMALL = 'fileSizeTooSmall'
Variable Summary
 integer|null $_max
 integer $_min
 integer $_size
 boolean $_useByteString
Method Summary
 Zend_Validate_File_Size __construct (integer|array $options)
 integer|string getMax ([bool $raw = false])
 integer|string getMin ([bool $raw = false])
 boolean isValid (string $value, [array $file = null])
 integer setUseByteString ([boolean $byteString = true])
 boolean useByteString ()
 integer _fromByteString (string $size)
 int _getSize ()
 false _throw (string $file, string $errorType)
 string _toByteString (integer $size)
Variables
integer|null $_max (line 76)

Maximum filesize

If null, there is no maximum filesize

  • access: protected
array $_messageTemplates = array(
self::TOO_BIG => "Maximum allowed size for file '%value%' is '%max%' but '%size%' detected",
self::TOO_SMALL => "Minimum expected size for file '%value%' is '%min%' but '%size%' detected",
self::NOT_FOUND => "File '%value%' could not be found",
)
(line 48)
  • var: Error message templates
  • access: protected

Redefinition of:
Zend_Validate_Abstract::$_messageTemplates
Validation failure message template definitions

Redefined in descendants as:
array $_messageVariables = array(
'min' => '_min',
'max' => '_max',
'size' => '_size',
)
(line 57)
  • var: Error message template variables
  • access: protected

Redefinition of:
Zend_Validate_Abstract::$_messageVariables
Additional variables available for validation failure messages
integer $_min (line 67)

Minimum filesize

  • access: protected
integer $_size (line 83)

Detected size

  • access: protected
boolean $_useByteString = true (line 90)

Use bytestring ?

  • access: protected

Inherited Variables

Inherited from Zend_Validate_Abstract

Zend_Validate_Abstract::$_defaultTranslator
Zend_Validate_Abstract::$_errors
Zend_Validate_Abstract::$_messageLength
Zend_Validate_Abstract::$_messages
Zend_Validate_Abstract::$_obscureValue
Zend_Validate_Abstract::$_translator
Zend_Validate_Abstract::$_translatorDisabled
Zend_Validate_Abstract::$_value
Methods
Constructor __construct (line 103)

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

  • access: public
Zend_Validate_File_Size __construct (integer|array $options)
  • integer|array $options: Options for the adapter

Redefined in descendants as:
getMax (line 206)

Returns the maximum filesize

  • access: public
integer|string getMax ([bool $raw = false])
  • bool $raw: Whether or not to force return of the raw value (defaults off)
getMin (line 164)

Returns the minimum filesize

  • access: public
integer|string getMin ([bool $raw = false])
  • bool $raw: Whether or not to force return of the raw value (defaults off)
isValid (line 274)

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

  • access: public
boolean isValid (string $value, [array $file = null])
  • string $value: Real file to check for size
  • array $file: File data from Zend_File_Transfer

Redefined in descendants as:
setMax (line 223)

Sets the maximum filesize

  • return: Provides a fluent interface
  • throws: Zend_Validate_Exception When max is smaller than min
  • access: public
Zend_Validate_StringLength setMax (integer $max)
  • integer $max: The maximum filesize
setMin (line 181)

Sets the minimum filesize

  • return: Provides a fluent interface
  • throws: Zend_Validate_Exception When min is greater than max
  • access: public
Zend_Validate_File_Size setMin (integer $min)
  • integer $min: The minimum filesize
setUseByteString (line 142)

Returns the minimum filesize

  • access: public
integer setUseByteString ([boolean $byteString = true])
  • boolean $byteString: Use bytestring ?
useByteString (line 153)

Will bytestring be used?

  • access: public
boolean useByteString ()
_fromByteString (line 343)

Returns the unformatted size

  • access: protected
integer _fromByteString (string $size)
  • string $size
_getSize (line 247)

Retrieve current detected file size

  • access: protected
int _getSize ()
_setSize (line 258)

Set current size

  • access: protected
Zend_Validate_File_Size _setSize (int $size)
  • int $size
_throw (line 395)

Throws an error of the given type

  • access: protected
false _throw (string $file, string $errorType)
  • string $file
  • string $errorType
_toByteString (line 327)

Returns the formatted size

  • access: protected
string _toByteString (integer $size)
  • integer $size

Inherited Methods

Inherited From Zend_Validate_Abstract

 Zend_Validate_Abstract::getDefaultTranslator()
 Zend_Validate_Abstract::getErrors()
 Zend_Validate_Abstract::getMessageLength()
 Zend_Validate_Abstract::getMessages()
 Zend_Validate_Abstract::getMessageTemplates()
 Zend_Validate_Abstract::getMessageVariables()
 Zend_Validate_Abstract::getObscureValue()
 Zend_Validate_Abstract::getTranslator()
 Zend_Validate_Abstract::hasDefaultTranslator()
 Zend_Validate_Abstract::hasTranslator()
 Zend_Validate_Abstract::setDefaultTranslator()
 Zend_Validate_Abstract::setDisableTranslator()
 Zend_Validate_Abstract::setMessage()
 Zend_Validate_Abstract::setMessageLength()
 Zend_Validate_Abstract::setMessages()
 Zend_Validate_Abstract::setObscureValue()
 Zend_Validate_Abstract::setTranslator()
 Zend_Validate_Abstract::translatorIsDisabled()
 Zend_Validate_Abstract::_createMessage()
 Zend_Validate_Abstract::_error()
 Zend_Validate_Abstract::_setValue()
 Zend_Validate_Abstract::__get()
Class Constants
NOT_FOUND = 'fileSizeNotFound' (line 42)
TOO_BIG = 'fileSizeTooBig' (line 40)
TOO_SMALL = 'fileSizeTooSmall' (line 41)

Documentation generated on Mon, 21 Jun 2010 15:45:03 -0400 by phpDocumentor 1.4.3