API Documentation

Zend/Form/Element/File.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_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-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Version
$Id: File.php 24594 2012-01-05 21:27:01Z matthew $  

Constants

Constant  TRANSFER_ADAPTER = 'TRANSFER_ADAPTER'

Plugin loader type

Properties

Propertyprotected\Zend_File_Transfer_Adapter_Abstract  $_adapter= ''

Propertyprotectedinteger  $_counter= '1'

Internal multifile counter
Default value1Details
Type
integer
Propertyprotectedinteger  $_maxFileSize= '-1'
static

Maximum file size for MAX_FILE_SIZE attribut of form
Default value-1Details
Type
integer
Propertyprotectedboolean  $_validated= 'false'

Already validated ?
Default valuefalseDetails
Type
boolean
Propertyprotectedboolean  $_valueDisabled= 'false'

Disable value to be equal to file content
Default valuefalseDetails
Type
boolean
Propertypublicstring  $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
Name Type Description
$setting string
Returns
Type Description
integer
methodprotected_getErrorMessages( ) : array

Retrieve error messages and perform translation and value substitution

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

Add Filter; proxy to adapter

Parameters
Name Type Description
$filter string|array

Type of filter to add

$options string|array

Options to set for the filter

Returns
Type Description
\Zend_Form_Element_File
methodpublicaddFilters( array $filters ) : \Zend_Form_Element_File

Add Multiple filters at once; proxy to adapter

Parameters
Name Type Description
$filters array
Returns
Type Description
\Zend_Form_Element_File
methodpublicaddPrefixPath( string $prefix, string $path, string $type = null ) : \Zend_Form_Element_File

Add prefix path for plugin loader

Parameters
Name Type Description
$prefix string
$path string
$type string
Returns
Type Description
\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
Name Type Description
$validator string|\Zend_Validate_Interface
$breakChainOnFailure bool
$options mixed
Returns
Type Description
\Zend_Form_Element_File
methodpublicaddValidators( array $validators ) : \Zend_Form_Element_File

Add multiple validators at once; proxy to adapter

Parameters
Name Type Description
$validators array
Returns
Type Description
\Zend_Form_Element_File
methodpublicclearFilters( ) : \Zend_Form_Element_File

Remove all filters; proxy to adapter

Returns
Type Description
\Zend_Form_Element_File
methodpublicclearValidators( ) : \Zend_Form_Element_File

Remove all validators; proxy to adapter

Returns
Type Description
\Zend_Form_Element_File
methodpublicgetDestination( ) : string

Get the upload destination

Returns
Type Description
string
methodpublicgetErrors( ) : array

Retrieve error codes; proxy to transfer adapter

Returns
Type Description
array
methodpublicgetFileInfo( string $value = null ) : array

Get internal file informations

Parameters
Name Type Description
$value string

(Optional) Element or file to return

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

Get the final filename

Parameters
Name Type Description
$value string

(Optional) Element or file to return

$path boolean

(Optional) Return also the path, defaults to true

Returns
Type Description
string
methodpublicgetFileSize( ) : string|array

Returns the filesize for this file element

Returns
Type Description
string|array Filesize
methodpublicgetFilter( string $name ) : \Zend_Filter_Interface|null

Retrieve individual filter; proxy to adapter

Parameters
Name Type Description
$name string
Returns
Type Description
\Zend_Filter_Interface|null
methodpublicgetFilters( ) : array

Returns all set filters; proxy to adapter

Returns
Type Description
array List of set filters
methodpublicgetHash( string $hash = 'crc32' ) : string|array

Returns the hash for this file element

Parameters
Name Type Description
$hash string

(Optional) Hash algorithm to use

Returns
Type Description
string|array Hashstring
methodpublicgetMaxFileSize( ) : integer

Sets the maximum file size of the form

Returns
Type Description
integer
methodpublicgetMessages( ) : array

Retrieve error messages; proxy to transfer adapter

Returns
Type Description
array
methodpublicgetMimeType( ) : string|array

Returns the mimetype for this file element

Returns
Type Description
string|array Mimetype
methodpublicgetMultiFile( ) : integer

Returns the multifile element number

Returns
Type Description
integer
methodpublicgetPluginLoader( string $type ) : \Zend_Loader_PluginLoader_Interface

Get Plugin Loader

Parameters
Name Type Description
$type string
Returns
Type Description
\Zend_Loader_PluginLoader_Interface
methodpublicgetTransferAdapter( ) : \Zend_File_Transfer_Adapter_Abstract

Get transfer adapter

Lazy loads HTTP transfer adapter when no adapter registered.

Returns
Type Description
\Zend_File_Transfer_Adapter_Abstract
methodpublicgetTranslator( ) : \Zend_Translate_Adapter|null

Retrieve localization translator object

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

Retrieve validator by name; proxy to adapter

Parameters
Name Type Description
$name string
Returns
Type Description
\Zend_Validate_Interface|null
methodpublicgetValidators( ) : array

Retrieve all validators; proxy to adapter

Returns
Type Description
array
methodpublicgetValue( ) : null|string

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

Returns
Type Description
null|string
methodpublichasErrors( ) : bool

Are there errors registered?

Returns
Type Description
bool
methodpublicisFiltered( ) : bool

Has the file been filtered?

Returns
Type Description
bool
methodpublicisReceived( ) : bool

Was the file received?

Returns
Type Description
bool
methodpublicisUploaded( ) : bool

Was the file uploaded?

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

Validate upload

Parameters
Name Type Description
$value string

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

$context mixed
Returns
Type Description
bool
methodpublicisValueDisabled( ) : boolean

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

Returns
Type Description
boolean Receive the file on calling getValues()?
methodpublicloadDefaultDecorators( ) : \Zend_Form_Element_File

Load default decorators

Returns
Type Description
\Zend_Form_Element_File
methodpublicreceive( ) : boolean

Receive the uploaded file

Returns
Type Description
boolean
methodpublicremoveFilter( string $name ) : \Zend_Form_Element_File

Remove an individual filter; proxy to adapter

Parameters
Name Type Description
$name string
Returns
Type Description
\Zend_Form_Element_File
methodpublicremoveValidator( string $name ) : \Zend_Form_Element_File

Remove validator by name; proxy to adapter

Parameters
Name Type Description
$name string
Returns
Type Description
\Zend_Form_Element_File
methodpublicrender( \Zend_View_Interface $view = null ) : string

Render form element Checks for decorator interface to prevent errors

Parameters
Name Type Description
$view \Zend_View_Interface
Returns
Type Description
string
methodpublicsetDestination( string $path ) : \Zend_Form_Element_File

Set the upload destination

Parameters
Name Type Description
$path string
Returns
Type Description
\Zend_Form_Element_File
methodpublicsetDisableTranslator( bool $flag ) : \Zend_Form_Element_File

Indicate whether or not translation should be disabled

Parameters
Name Type Description
$flag bool
Returns
Type Description
\Zend_Form_Element_File
methodpublicsetFilters(  $filters ) : \Zend_Form_Element_File

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

Parameters
Name Type Description
$filters
Returns
Type Description
\Zend_Form_Element_File
methodpublicsetMaxFileSize( integer $size ) : integer

Sets the maximum file size of the form

Parameters
Name Type Description
$size integer
Returns
Type Description
integer
methodpublicsetMultiFile( integer $count ) : \Zend_Form_Element_File

Set a multifile element

Parameters
Name Type Description
$count integer

Number of file elements

Returns
Type Description
\Zend_Form_Element_File Provides fluent interface
methodpublicsetPluginLoader( \Zend_Loader_PluginLoader_Interface $loader, string $type ) : \Zend_Form_Element_File

Set plugin loader

Parameters
Name Type Description
$loader \Zend_Loader_PluginLoader_Interface
$type string
Returns
Type Description
\Zend_Form_Element_File
methodpublicsetTransferAdapter( string|\Zend_File_Transfer_Adapter_Abstract $adapter ) : \Zend_Form_Element_File

Set transfer adapter

Parameters
Name Type Description
$adapter string|\Zend_File_Transfer_Adapter_Abstract
Returns
Type Description
\Zend_Form_Element_File
methodpublicsetTranslator( \Zend_Translate|null $translator = null ) : \Zend_Form_Element_File

Set translator object for localization

Parameters
Name Type Description
$translator \Zend_Translate|null
Returns
Type Description
\Zend_Form_Element_File
methodpublicsetValidators( array $validators ) : \Zend_Form_Element_File

Add multiple validators at once, overwriting; proxy to adapter

Parameters
Name Type Description
$validators array
Returns
Type Description
\Zend_Form_Element_File
methodpublicsetValue( mixed $value ) : \Zend_Form_Element_File

Disallow setting the value

Parameters
Name Type Description
$value mixed
Returns
Type Description
\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
Name Type Description
$flag boolean

Sets if the file is handled as the elements value

Returns
Type Description
\Zend_Form_Element_File
methodpublictranslatorIsDisabled( ) : bool

Is translation disabled?

Returns
Type Description
bool
Documentation was generated by DocBlox 0.15.1.