API Documentation

Zend/Validate/File/Upload.php

Show: inherited
Table of Contents

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.

Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Validate  
Version
$Id: Upload.php 24594 2012-01-05 21:27:01Z matthew $  

\Zend_Validate_File_Upload

Package: Zend\Validate

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

Parent(s)
\Zend_Validate_Abstract
Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Constants

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

Properties

Propertyprotectedarray  $_files= 'array()'

Internal array of files

Default valuearray()Details
Type
array
Propertyprotectedarray  $_messageTemplates= 'array( self::INI_SIZE => "File '%value%' exceeds the defined ini size"'

Error message templates
Default valuearray( self::INI_SIZE => "File '%value%' exceeds the defined ini size"Details
Type
array

Methods

methodpublic__construct( array|\Zend_Config $files = array() ) : void

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
Name Type Description
$files array|\Zend_Config

Array of files in syntax of Zend_File_Transfer

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

Throws an error of the given type

Parameters
Name Type Description
$file string
$errorType string
Returns
Type Description
false
methodpublicgetFiles(  $file = null ) : array

Returns the array of set files

Parameters
Name Type Description
$file
Returns
Type Description
array
Throws
Exception Description
\Zend_Validate_Exception If file is not found
methodpublicisValid( string $value,  $file = null ) : boolean

Defined by Zend_Validate_Interface

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

Parameters
Name Type Description
$value string

Single file to check for upload errors, when giving null the $_FILES array from initialization will be used

$file
Returns
Type Description
boolean
methodpublicsetFiles( array $files = array() ) : \Zend_Validate_File_Upload

Sets the files to be checked

Parameters
Name Type Description
$files array

The files to check in syntax of Zend_File_Transfer

Returns
Type Description
\Zend_Validate_File_Upload Provides a fluent interface
Documentation was generated by DocBlox 0.15.1.