Validate/File/Upload.php

Show: PublicProtectedPrivateinherited
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-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Validate  
Version
$Id$  

\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-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Constants

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

Properties

>VPropertyprotectedarray $_files = array()
Internal array of files
Default valuearray()Details
Type
array
>VPropertyprotectedarray $_messageTemplates = array(self::INI_SIZE => "File '%value%' exceeds the defined ini size", self::FORM_SIZE => "File '%value%' exceeds the defined form size", self::PARTIAL => "File '%value%' was only partially uploaded", self::NO_FILE => "File '%value%' was not uploaded", self::NO_TMP_DIR => "No temporary directory was found for file '%value%'", self::CANT_WRITE => "File '%value%' can't be written", self::EXTENSION => "A PHP extension returned an error while uploading the file '%value%'", self::ATTACK => "File '%value%' was illegally uploaded. This could be a possible attack", self::FILE_NOT_FOUND => "File '%value%' was not found", self::UNKNOWN => "Unknown error while uploading file '%value%'")

Error message templates

Default valuearray(self::INI_SIZE => "File '%value%' exceeds the defined ini size", self::FORM_SIZE => "File '%value%' exceeds the defined form size", self::PARTIAL => "File '%value%' was only partially uploaded", self::NO_FILE => "File '%value%' was not uploaded", self::NO_TMP_DIR => "No temporary directory was found for file '%value%'", self::CANT_WRITE => "File '%value%' can't be written", self::EXTENSION => "A PHP extension returned an error while uploading the file '%value%'", self::ATTACK => "File '%value%' was illegally uploaded. This could be a possible attack", self::FILE_NOT_FOUND => "File '%value%' was not found", self::UNKNOWN => "Unknown error while uploading file '%value%'")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
NameTypeDescription
$filesarray | \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
NameTypeDescription
$filestring
$errorTypestring
Returns
TypeDescription
false
methodpublicgetFiles( $file = null) : array

Returns the array of set files

Parameters
NameTypeDescription
$file
Returns
TypeDescription
array
Throws
ExceptionDescription
\Zend_Validate_ExceptionIf 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
NameTypeDescription
$valuestring

Single file to check for upload errors, when giving null the $_FILES array

                  from initialization will be used
$file
Returns
TypeDescription
boolean
methodpublicsetFiles(array $files = array()) : \Zend_Validate_File_Upload

Sets the files to be checked

Parameters
NameTypeDescription
$filesarray

The files to check in syntax of Zend_File_Transfer

Returns
TypeDescription
\Zend_Validate_File_UploadProvides a fluent interface
Documentation was generated by phpDocumentor 2.2.0 .