Public Member Functions | Data Fields | Protected Member Functions | Protected Attributes

Zend_Validate_File_Upload Class Reference

Inheritance diagram for Zend_Validate_File_Upload:
Zend_Validate_Abstract Zend_Validate_Interface

Public Member Functions

 __construct ($files=array())
 getFiles ($file=null)
 setFiles ($files=array())
 isValid ($value, $file=null)

Data Fields

const INI_SIZE = 'fileUploadErrorIniSize'
const FORM_SIZE = 'fileUploadErrorFormSize'
const PARTIAL = 'fileUploadErrorPartial'
const NO_FILE = 'fileUploadErrorNoFile'
const NO_TMP_DIR = 'fileUploadErrorNoTmpDir'
const CANT_WRITE = 'fileUploadErrorCantWrite'
const EXTENSION = 'fileUploadErrorExtension'
const ATTACK = 'fileUploadErrorAttack'
const FILE_NOT_FOUND = 'fileUploadErrorFileNotFound'
const UNKNOWN = 'fileUploadErrorUnknown'

Protected Member Functions

 _throw ($file, $errorType)

Protected Attributes

 $_messageTemplates
 $_files = array()

Detailed Description

Definition at line 35 of file Upload.php.


Constructor & Destructor Documentation

__construct ( files = array() )

Sets validator options

The array $files must be given in syntax of Zend_File_Transfer to be checked If no files are given the $_FILES array will be used automatically. NOTE: This validator will only work with HTTP POST uploads!

Parameters:
array | Zend_Config$filesArray of files in syntax of Zend_File_Transfer
Returns:
void

Definition at line 84 of file Upload.php.


Member Function Documentation

_throw ( file,
errorType 
) [protected]

Throws an error of the given type

Parameters:
string$file
string$errorType
Returns:
false

Definition at line 234 of file Upload.php.

getFiles ( file = null )

Returns the array of set files

Parameters:
string$files(Optional) The file to return in detail
Returns:
array
Exceptions:
Zend_Validate_ExceptionIf file is not found

Definition at line 100 of file Upload.php.

isValid ( value,
file = null 
)

Defined by Zend_Validate_Interface

Returns true if and only if the file was uploaded without errors

Parameters:
string$valueSingle file to check for upload errors, when giving null the $_FILES array from initialization will be used
Returns:
boolean

Definition at line 157 of file Upload.php.

setFiles ( files = array() )

Sets the files to be checked

Parameters:
array$filesThe files to check in syntax of Zend_File_Transfer
Returns:
Zend_Validate_File_Upload Provides a fluent interface

Definition at line 131 of file Upload.php.


Field Documentation

$_messageTemplates [protected]
Initial value:
 array(
        self::INI_SIZE       => "The file '%value%' exceeds the defined ini size",
        self::FORM_SIZE      => "The file '%value%' exceeds the defined form size",
        self::PARTIAL        => "The file '%value%' was only partially uploaded",
        self::NO_FILE        => "The file '%value%' was not uploaded",
        self::NO_TMP_DIR     => "No temporary directory was found for the file '%value%'",
        self::CANT_WRITE     => "The file '%value%' can't be written",
        self::EXTENSION      => "The extension returned an error while uploading the file '%value%'",
        self::ATTACK         => "The file '%value%' was illegal uploaded, possible attack",
        self::FILE_NOT_FOUND => "The file '%value%' was not found",
        self::UNKNOWN        => "Unknown error while uploading the file '%value%'"
    )

Reimplemented from Zend_Validate_Abstract.

Definition at line 55 of file Upload.php.

const INI_SIZE = 'fileUploadErrorIniSize'

#+ string Error constants

Definition at line 40 of file Upload.php.


The documentation for this class was generated from the following file: