Form/Element/File.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_Form  

\Zend_Form_Element_File

Package: Zend_Form\Element
Zend_Form_Element
Parent(s)
\Zend_Form_Element_Xhtml < \Zend_Form_Element
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Version
$Id$  

Constants

>VConstant  TRANSFER_ADAPTER = 'TRANSFER_ADAPTER'
Plugin loader type

Properties

>VPropertyprotected\Zend_File_Transfer_Adapter_Abstract $_adapter
>VPropertyprotectedinteger $_counter = 1

Internal multifile counter

Default value1Details
Type
integer
>VPropertyprotectedinteger $_maxFileSize = -1
static

Maximum file size for MAX_FILE_SIZE attribut of form

Default value-1Details
Type
integer
>VPropertyprotectedboolean $_validated = false

Already validated ?

Default valuefalseDetails
Type
boolean
>VPropertyprotectedboolean $_valueDisabled = false

Disable value to be equal to file content

Default valuefalseDetails
Type
boolean
>VPropertypublicstring $helper = 'formFile'

Default view helper

Default value'formFile'Details
Type
string

Methods

methodprivate_convertIniToInteger(string $setting) : integer

Converts a ini setting to a integer value

Parameters
NameTypeDescription
$settingstring
Returns
TypeDescription
integer
methodprotected_getErrorMessages() : array

Retrieve error messages and perform translation and value substitution

Returns
TypeDescription
array
methodpublicaddFilter(string | array $filter, string | array $options = null) : \Zend_Form_Element_File

Add Filter; proxy to adapter

Parameters
NameTypeDescription
$filterstring | array

Type of filter to add

$optionsstring | array

Options to set for the filter

Returns
TypeDescription
\Zend_Form_Element_File
methodpublicaddFilters(array $filters) : \Zend_Form_Element_File

Add Multiple filters at once; proxy to adapter

Parameters
NameTypeDescription
$filtersarray
Returns
TypeDescription
\Zend_Form_Element_File
methodpublicaddPrefixPath(string $prefix, string $path, string $type = null) : \Zend_Form_Element_File

Add prefix path for plugin loader

Parameters
NameTypeDescription
$prefixstring
$pathstring
$typestring
Returns
TypeDescription
\Zend_Form_Element_File
methodpublicaddValidator(string | \Zend_Validate_Interface $validator, bool $breakChainOnFailure = false, mixed $options = array()) : \Zend_Form_Element_File

Add Validator; proxy to adapter

Parameters
NameTypeDescription
$validatorstring | \Zend_Validate_Interface
$breakChainOnFailurebool
$optionsmixed
Returns
TypeDescription
\Zend_Form_Element_File
methodpublicaddValidators(array $validators) : \Zend_Form_Element_File

Add multiple validators at once; proxy to adapter

Parameters
NameTypeDescription
$validatorsarray
Returns
TypeDescription
\Zend_Form_Element_File
methodpublicclearFilters() : \Zend_Form_Element_File

Remove all filters; proxy to adapter

Returns
TypeDescription
\Zend_Form_Element_File
methodpublicclearValidators() : \Zend_Form_Element_File

Remove all validators; proxy to adapter

Returns
TypeDescription
\Zend_Form_Element_File
methodpublicgetDestination() : string

Get the upload destination

Returns
TypeDescription
string
methodpublicgetErrors() : array

Retrieve error codes; proxy to transfer adapter

Returns
TypeDescription
array
methodpublicgetFileInfo(string $value = null) : array

Get internal file informations

Parameters
NameTypeDescription
$valuestring

(Optional) Element or file to return

Returns
TypeDescription
array
methodpublicgetFileName(string $value = null, boolean $path = true) : string

Get the final filename

Parameters
NameTypeDescription
$valuestring

(Optional) Element or file to return

$pathboolean

(Optional) Return also the path, defaults to true

Returns
TypeDescription
string
methodpublicgetFileSize() : string | array

Returns the filesize for this file element

Returns
TypeDescription
string | arrayFilesize
methodpublicgetFilter(string $name) : \Zend_Filter_Interface | null

Retrieve individual filter; proxy to adapter

Parameters
NameTypeDescription
$namestring
Returns
TypeDescription
\Zend_Filter_Interface | null
methodpublicgetFilters() : array

Returns all set filters; proxy to adapter

Returns
TypeDescription
arrayList of set filters
methodpublicgetHash(string $hash = 'crc32') : string | array

Returns the hash for this file element

Parameters
NameTypeDescription
$hashstring

(Optional) Hash algorithm to use

Returns
TypeDescription
string | arrayHashstring
methodpublicgetMaxFileSize() : integer

Sets the maximum file size of the form

Returns
TypeDescription
integer
methodpublicgetMessages() : array

Retrieve error messages; proxy to transfer adapter

Returns
TypeDescription
array
methodpublicgetMimeType() : string | array

Returns the mimetype for this file element

Returns
TypeDescription
string | arrayMimetype
methodpublicgetMultiFile() : integer

Returns the multifile element number

Returns
TypeDescription
integer
methodpublicgetPluginLoader(string $type) : \Zend_Loader_PluginLoader_Interface

Get Plugin Loader

Parameters
NameTypeDescription
$typestring
Returns
TypeDescription
\Zend_Loader_PluginLoader_Interface
methodpublicgetTransferAdapter() : \Zend_File_Transfer_Adapter_Abstract

Get transfer adapter

Lazy loads HTTP transfer adapter when no adapter registered.
Returns
TypeDescription
\Zend_File_Transfer_Adapter_Abstract
methodpublicgetTranslator() : \Zend_Translate_Adapter | null

Retrieve localization translator object

Returns
TypeDescription
\Zend_Translate_Adapter | null
methodpublicgetValidator(string $name) : \Zend_Validate_Interface | null

Retrieve validator by name; proxy to adapter

Parameters
NameTypeDescription
$namestring
Returns
TypeDescription
\Zend_Validate_Interface | null
methodpublicgetValidators() : array

Retrieve all validators; proxy to adapter

Returns
TypeDescription
array
methodpublicgetValue() : null | string

Processes the file, returns null or the filename only For the complete path, use getFileName

Returns
TypeDescription
null | string
methodpublichasErrors() : bool

Are there errors registered?

Returns
TypeDescription
bool
methodpublicisFiltered() : bool

Has the file been filtered?

Returns
TypeDescription
bool
methodpublicisReceived() : bool

Was the file received?

Returns
TypeDescription
bool
methodpublicisUploaded() : bool

Was the file uploaded?

Returns
TypeDescription
bool
methodpublicisValid(string $value, mixed $context = null) : bool

Validate upload

Parameters
NameTypeDescription
$valuestring

File, can be optional, give null to validate all files

$contextmixed
Returns
TypeDescription
bool
methodpublicisValueDisabled() : boolean

Returns if the file will be uploaded when calling getValues()

Returns
TypeDescription
booleanReceive the file on calling getValues()?
methodpublicloadDefaultDecorators() : \Zend_Form_Element_File

Load default decorators

Returns
TypeDescription
\Zend_Form_Element_File
methodpublicreceive() : boolean

Receive the uploaded file

Returns
TypeDescription
boolean
methodpublicremoveFilter(string $name) : \Zend_Form_Element_File

Remove an individual filter; proxy to adapter

Parameters
NameTypeDescription
$namestring
Returns
TypeDescription
\Zend_Form_Element_File
methodpublicremoveValidator(string $name) : \Zend_Form_Element_File

Remove validator by name; proxy to adapter

Parameters
NameTypeDescription
$namestring
Returns
TypeDescription
\Zend_Form_Element_File
methodpublicrender(\Zend_View_Interface $view = null) : string

Render form element Checks for decorator interface to prevent errors

Parameters
NameTypeDescription
$view\Zend_View_Interface
Returns
TypeDescription
string
Throws
ExceptionDescription
\Zend_Form_Element_Exception
methodpublicsetDestination(string $path) : \Zend_Form_Element_File

Set the upload destination

Parameters
NameTypeDescription
$pathstring
Returns
TypeDescription
\Zend_Form_Element_File
methodpublicsetDisableTranslator(bool $flag) : \Zend_Form_Element_File

Indicate whether or not translation should be disabled

Parameters
NameTypeDescription
$flagbool
Returns
TypeDescription
\Zend_Form_Element_File
methodpublicsetFilters(array $filters) : \Zend_Form_Element_File

Sets a filter for the class, erasing all previous set; proxy to adapter

Parameters
NameTypeDescription
$filtersarray

Filters to set

Returns
TypeDescription
\Zend_Form_Element_File
methodpublicsetMaxFileSize(integer $size) : integer

Sets the maximum file size of the form

Parameters
NameTypeDescription
$sizeinteger
Returns
TypeDescription
integer
methodpublicsetMultiFile(integer $count) : \Zend_Form_Element_File

Set a multifile element

Parameters
NameTypeDescription
$countinteger

Number of file elements

Returns
TypeDescription
\Zend_Form_Element_FileProvides fluent interface
methodpublicsetPluginLoader(\Zend_Loader_PluginLoader_Interface $loader, string $type) : \Zend_Form_Element_File

Set plugin loader

Parameters
NameTypeDescription
$loader\Zend_Loader_PluginLoader_Interface
$typestring
Returns
TypeDescription
\Zend_Form_Element_File
methodpublicsetTransferAdapter(string | \Zend_File_Transfer_Adapter_Abstract $adapter) : \Zend_Form_Element_File

Set transfer adapter

Parameters
NameTypeDescription
$adapterstring | \Zend_File_Transfer_Adapter_Abstract
Returns
TypeDescription
\Zend_Form_Element_File
Throws
ExceptionDescription
\Zend_Form_Element_Exception
methodpublicsetTranslator(\Zend_Translate | null $translator = null) : \Zend_Form_Element_File

Set translator object for localization

Parameters
NameTypeDescription
$translator\Zend_Translate | null
Returns
TypeDescription
\Zend_Form_Element_File
methodpublicsetValidators(array $validators) : \Zend_Form_Element_File

Add multiple validators at once, overwriting; proxy to adapter

Parameters
NameTypeDescription
$validatorsarray
Returns
TypeDescription
\Zend_Form_Element_File
methodpublicsetValue(mixed $value) : \Zend_Form_Element_File

Disallow setting the value

Parameters
NameTypeDescription
$valuemixed
Returns
TypeDescription
\Zend_Form_Element_File
methodpublicsetValueDisabled(boolean $flag) : \Zend_Form_Element_File

Set if the file will be uploaded when getting the value This defaults to false which will force receive() when calling getValues()

Parameters
NameTypeDescription
$flagboolean

Sets if the file is handled as the elements value

Returns
TypeDescription
\Zend_Form_Element_File
methodpublictranslatorIsDisabled() : bool

Is translation disabled?

Returns
TypeDescription
bool
Documentation was generated by phpDocumentor 2.2.0 .