This class needs a full rewrite. It re-implements functionality present in
Zend\Filter\Input and/or Zend\Form\Element, and in a way that's inconsistent
with either one. Additionally, plugin loader usage is now deprecated -- but
modifying that should be done in tandem with a rewrite to utilize validator
and filter chains instead.
Methods
Constructor for Http File Transfers
__construct(array $options)
Parameters
$options
array
OPTIONAL Options to set
Exceptions
Adds a new filter for this class
addFilter(string | \Zend\Filter\FilterInterface $filter, string | array $options, string | array $files) : \Zend\File\Transfer\Adapter\AbstractAdapter
Inherited
inherited_from |
\Zend\File\Transfer\Adapter\AbstractAdapter::addFilter() |
Parameters
$options
stringarray
Options to set for the filter
$files
stringarray
Files to limit this filter to
Exceptions
Returns
Add Multiple filters at once
addFilters(array $filters, string | array $files) : \Zend\File\Transfer\Adapter\AbstractAdapter
Inherited
inherited_from |
\Zend\File\Transfer\Adapter\AbstractAdapter::addFilters() |
Parameters
$filters
array
$files
stringarray
Returns
Adds a new validator for this class
addValidator(string | \Zend\Validator\ValidatorInterface $validator, bool $breakChainOnFailure, string | array $options, string | array $files) : \Zend\File\Transfer\Adapter\AbstractAdapter
Inherited
inherited_from |
\Zend\File\Transfer\Adapter\AbstractAdapter::addValidator() |
Parameters
$breakChainOnFailure
bool
If the validation chain should stop a failure
$options
stringarray
Options to set for the validator
$files
stringarray
Files to limit this validator to
Exceptions
Returns
Add Multiple validators at once
addValidators(array $validators, string | array $files) : \Zend\File\Transfer\Adapter\AbstractAdapter
Inherited
inherited_from |
\Zend\File\Transfer\Adapter\AbstractAdapter::addValidators() |
Parameters
$validators
array
$files
stringarray
Exceptions
Returns
Retrieve destination directory value
getDestination(null | string | array $files) : null | string | array
Inherited
inherited_from |
\Zend\File\Transfer\Adapter\AbstractAdapter::getDestination() |
Parameters
$files
nullstringarray
Exceptions
Returns
null
string
array
Retrieve error codes
getErrors() : array
Inherited
inherited_from |
\Zend\File\Transfer\Adapter\AbstractAdapter::getErrors() |
Returns
array
Retrieve additional internal file informations for files
getFileInfo(string $file) : array
Inherited
inherited_from |
\Zend\File\Transfer\Adapter\AbstractAdapter::getFileInfo() |
Parameters
$file
string
(Optional) File to get informations for
Returns
array
Retrieves the filename of transferred files.
getFileName(string $file, bool $path) : string | array
Inherited
inherited_from |
\Zend\File\Transfer\Adapter\AbstractAdapter::getFileName() |
Parameters
$file
string
(Optional) Element to return the filename for
$path
bool
(Optional) Should the path also be returned ?
Returns
string
array
Returns the real filesize of the file
getFileSize(string | array $files) : string | array
Inherited
inherited_from |
\Zend\File\Transfer\Adapter\AbstractAdapter::getFileSize() |
Parameters
$files
stringarray
Files to get the filesize from
Exceptions
Returns
string
array
Filesize
Retrieve individual filter
getFilter(string $name) : \Zend\Filter\FilterInterface | null
Inherited
inherited_from |
\Zend\File\Transfer\Adapter\AbstractAdapter::getFilter() |
Parameters
$name
string
Returns
Returns all set filters
getFilters(string | array $files) : array
Inherited
inherited_from |
\Zend\File\Transfer\Adapter\AbstractAdapter::getFilters() |
Parameters
$files
stringarray
(Optional) Returns the filter for this files
Exceptions
Returns
array
List of set filters
Returns the hash for a given file
getHash(string $hash, string | array $files) : string | array
Inherited
inherited_from |
\Zend\File\Transfer\Adapter\AbstractAdapter::getHash() |
Parameters
$hash
string
Hash algorithm to use
$files
stringarray
Files to return the hash for
Exceptions
Returns
string
array
Hashstring
Returns found validation messages
getMessages() : array
Inherited
inherited_from |
\Zend\File\Transfer\Adapter\AbstractAdapter::getMessages() |
Returns
array
Returns the real mimetype of the file
Uses fileinfo, when not available mime_magic and as last fallback a manual given mimetype
getMimeType(string | array $files) : string | array
Inherited
inherited_from |
\Zend\File\Transfer\Adapter\AbstractAdapter::getMimeType() |
Parameters
$files
stringarray
Files to get the mimetype from
Exceptions
Returns
string
array
MimeType
Returns set options for adapters or files
getOptions(array $files) : array
Inherited
inherited_from |
\Zend\File\Transfer\Adapter\AbstractAdapter::getOptions() |
Parameters
$files
array
(Optional) Files to return the options for
Returns
array
Options for given files
Returns the actual progress of file up-/downloads
getProgress(string | array $id) : array | null
Parameters
$id
stringarray
The upload to get the progress for
Exceptions
Returns
array
null
Return the translation text domain
getTranslatorTextDomain() : string
Inherited
inherited_from |
\Zend\File\Transfer\Adapter\AbstractAdapter::getTranslatorTextDomain() |
Returns
string
Retrieve individual validator
getValidator(string $name) : \Zend\Validator\ValidatorInterface | null
Inherited
inherited_from |
\Zend\File\Transfer\Adapter\AbstractAdapter::getValidator() |
Parameters
$name
string
Returns
Returns all set validators
getValidators(string | array $files) : null | array
Inherited
inherited_from |
\Zend\File\Transfer\Adapter\AbstractAdapter::getValidators() |
Parameters
$files
stringarray
(Optional) Returns the validator for this files
Returns
null
array
List of set validators
Are there errors registered?
hasErrors() : bool
Inherited
inherited_from |
\Zend\File\Transfer\Adapter\AbstractAdapter::hasErrors() |
Returns
bool
Determine if a given filter has already been registered
hasFilter(string $name) : bool
Inherited
inherited_from |
\Zend\File\Transfer\Adapter\AbstractAdapter::hasFilter() |
Parameters
$name
string
Returns
bool
Checks if the helper has a translator
hasTranslator() : bool
Inherited
inherited_from |
\Zend\File\Transfer\Adapter\AbstractAdapter::hasTranslator() |
Returns
bool
Determine if a given validator has already been registered
hasValidator(string $name) : bool
Inherited
inherited_from |
\Zend\File\Transfer\Adapter\AbstractAdapter::hasValidator() |
Parameters
$name
string
Returns
bool
Checks the APC extension for progress information
isApcAvailable() : bool
Checks if the file was already filtered
isFiltered(string | array $files) : bool
Parameters
$files
stringarray
(Optional) Files to check
Returns
bool
Checks if the file was already received
isReceived(string | array $files) : bool
Parameters
$files
stringarray
(Optional) Files to check
Returns
bool
Checks if the file was already sent
isSent(string | array $files) : bool
Parameters
$files
stringarray
Files to check
Exceptions
Returns
bool
Is translation enabled?
isTranslatorEnabled() : bool
Inherited
inherited_from |
\Zend\File\Transfer\Adapter\AbstractAdapter::isTranslatorEnabled() |
Returns
bool
Checks the UploadProgress extension for progress information
isUploadProgressAvailable() : bool
Has a file been uploaded ?
isUploaded(array | string | null $files) : bool
Parameters
$files
arraystringnull
Returns
bool
Checks if the files are valid
isValid(string | array $files) : bool
Parameters
$files
stringarray
(Optional) Files to check
Returns
bool
True if all checks are valid
Receive the file from the client (Upload)
receive(string | array $files) : bool
Parameters
$files
stringarray
(Optional) Files to receive
Returns
bool
Remove an individual filter
removeFilter(string $name) : \Zend\File\Transfer\Adapter\AbstractAdapter
Inherited
inherited_from |
\Zend\File\Transfer\Adapter\AbstractAdapter::removeFilter() |
Parameters
$name
string
Returns
Send the file to the client (Download)
send(string | array $options) : void
Parameters
$options
stringarray
Options for the file(s) to send
Exceptions
Sets a new destination for the given files
setDestination(string $destination, string | array $files) : \Zend\File\Transfer\Adapter\AbstractAdapter
Inherited
inherited_from |
\Zend\File\Transfer\Adapter\AbstractAdapter::setDestination() |
Parameters
$destination
string
New destination directory
$files
stringarray
Files to set the new destination for
Exceptions
Returns
Set the filter plugin manager instance
setFilterManager(\Zend\File\Transfer\Adapter\FilterPluginManager $filterManager) : \Zend\File\Transfer\Adapter\AbstractAdapter
Inherited
inherited_from |
\Zend\File\Transfer\Adapter\AbstractAdapter::setFilterManager() |
Parameters
Returns
Sets a filter for the class, erasing all previous set
setFilters(array $filters, string | array $files) : \Zend\Filter\AbstractFilter
Inherited
inherited_from |
\Zend\File\Transfer\Adapter\AbstractAdapter::setFilters() |
Parameters
$filters
array
Filter to set
$files
stringarray
Files to limit this filter to
Returns
Sets Options for adapters
setOptions(array $options, array $files) : \Zend\File\Transfer\Adapter\AbstractAdapter
Inherited
inherited_from |
\Zend\File\Transfer\Adapter\AbstractAdapter::setOptions() |
Parameters
$options
array
Options to set
$files
array
(Optional) Files to set the options for
Returns
Sets translator to use in helper
setTranslator(\Zend\I18n\Translator\TranslatorInterface $translator, string $textDomain) : \Zend\File\Transfer\Adapter\AbstractAdapter
Inherited
inherited_from |
\Zend\File\Transfer\Adapter\AbstractAdapter::setTranslator() |
Parameters
$textDomain
string
[optional] text domain Default is null, which skips setTranslatorTextDomain
Returns
Indicate whether or not translation should be enabled
setTranslatorEnabled(bool $flag) : \Zend\File\Transfer\Adapter\AbstractAdapter
Inherited
inherited_from |
\Zend\File\Transfer\Adapter\AbstractAdapter::setTranslatorEnabled() |
Parameters
$flag
bool
Returns
Set translation text domain
setTranslatorTextDomain(string $textDomain) : \Zend\File\Transfer\Adapter\AbstractAdapter
Inherited
inherited_from |
\Zend\File\Transfer\Adapter\AbstractAdapter::setTranslatorTextDomain() |
Parameters
$textDomain
string
Returns
Set the validator plugin manager instance
setValidatorManager(\Zend\File\Transfer\Adapter\ValidatorPluginManager $validatorManager) : \Zend\File\Transfer\Adapter\AbstractAdapter
Inherited
inherited_from |
\Zend\File\Transfer\Adapter\AbstractAdapter::setValidatorManager() |
Parameters
Returns
Sets a validator for the class, erasing all previous set
setValidators(array $validators, string | array $files) : \Zend\File\Transfer\Adapter\AbstractAdapter
Parameters
$validators
array
Validator to set
$files
stringarray
Files to limit this validator to
Returns
Internal method to detect the size of a file
detectFileSize(array $value) : string
Inherited
inherited_from |
\Zend\File\Transfer\Adapter\AbstractAdapter::detectFileSize() |
Parameters
Returns
string
Filesize of given file
Internal method to detect the mime type of a file
detectMimeType(array $value) : string
Inherited
inherited_from |
\Zend\File\Transfer\Adapter\AbstractAdapter::detectMimeType() |
Parameters
Returns
string
Mimetype of given file
Internal function to filter all given files
filter(string | array $files) : bool
Inherited
inherited_from |
\Zend\File\Transfer\Adapter\AbstractAdapter::filter() |
Parameters
$files
stringarray
(Optional) Files to check
Returns
bool
False on error
Returns found files based on internal file array and given files
getFiles(string | array $files, bool $names, bool $noexception) : array
Inherited
inherited_from |
\Zend\File\Transfer\Adapter\AbstractAdapter::getFiles() |
Parameters
$files
stringarray
(Optional) Files to return
$names
bool
(Optional) Returns only names on true, else complete info
$noexception
bool
(Optional) Allows throwing an exception, otherwise returns an empty array
Exceptions
Returns
array
Found files
Retrieve internal identifier for a named filter
getFilterIdentifier(string $name) : string
Inherited
inherited_from |
\Zend\File\Transfer\Adapter\AbstractAdapter::getFilterIdentifier() |
Parameters
$name
string
Returns
string
Determine system TMP directory and detect if we have read access
getTmpDir() : string
Inherited
inherited_from |
\Zend\File\Transfer\Adapter\AbstractAdapter::getTmpDir() |
Exceptions
Returns
string
Retrieve internal identifier for a named validator
getValidatorIdentifier(string $name) : string
Inherited
inherited_from |
\Zend\File\Transfer\Adapter\AbstractAdapter::getValidatorIdentifier() |
Parameters
$name
string
Returns
string
Tries to detect if we can read and write to the given path
isPathWriteable(string $path) : bool
Inherited
inherited_from |
\Zend\File\Transfer\Adapter\AbstractAdapter::isPathWriteable() |
Parameters
$path
string
Returns
bool
Returns the formatted size
toByteString(int $size) : string
Inherited
inherited_from |
\Zend\File\Transfer\Adapter\AbstractAdapter::toByteString() |
Parameters
$size
int
Returns
string
Properties
Internal list of breaks
$break : array
Inherited
inherited_from |
\Zend\File\Transfer\Adapter\AbstractAdapter::$$break |
$callbackApc
$callbackApc
$callbackUploadProgress
$callbackUploadProgress
Internal list of files
This array looks like this:
array(form => array( - Form is the name within the form or, if not set the filename
name, - Original name of this file
type, - Mime type of this file
size, - Filesize in bytes
tmp_name, - Internally temporary filename for uploaded files
error, - Error which has occurred
destination, - New destination for this file
validators, - Set validator names for this file
files - Set file names for this file
))
$files : array
Inherited
inherited_from |
\Zend\File\Transfer\Adapter\AbstractAdapter::$$files |
Internal list of filters
$filters : array
Inherited
inherited_from |
\Zend\File\Transfer\Adapter\AbstractAdapter::$$filters |
Plugin loaders for filter and validation chains
$loaders : array
Inherited
inherited_from |
\Zend\File\Transfer\Adapter\AbstractAdapter::$$loaders |
Internal list of messages
$messages : array
Inherited
inherited_from |
\Zend\File\Transfer\Adapter\AbstractAdapter::$$messages |
Available options for file transfers
$options
Inherited
inherited_from |
\Zend\File\Transfer\Adapter\AbstractAdapter::$$options |
TMP directory
$tmpDir : string
Inherited
inherited_from |
\Zend\File\Transfer\Adapter\AbstractAdapter::$$tmpDir |
Is translation enabled?
$translatorEnabled : bool
Inherited
inherited_from |
\Zend\File\Transfer\Adapter\AbstractAdapter::$$translatorEnabled |
Translator text domain (optional)
$translatorTextDomain : string
Inherited
inherited_from |
\Zend\File\Transfer\Adapter\AbstractAdapter::$$translatorTextDomain |
Internal list of validators
$validators : array
Inherited
inherited_from |
\Zend\File\Transfer\Adapter\AbstractAdapter::$$validators |
Constants
FILTER
FILTER
Inherited
inherited_from |
\Zend\File\Transfer\Adapter\AbstractAdapter::FILTER |
VALIDATOR
VALIDATOR
Inherited
inherited_from |
\Zend\File\Transfer\Adapter\AbstractAdapter::VALIDATOR |