package Default
inherited_from \Zend\Filter\AbstractFilter

 Methods

Constructor

__construct(array|string $targetOrOptions) 

Parameters

$targetOrOptions

arraystring

The target file path or an options array

Invoke filter as a command

__invoke(mixed $value) : mixed
Inherited

Proxies to \filter()

Parameters

$value

mixed

Exceptions

\Zend\Filter\Exception\ExceptionInterface If filtering $value is impossible

Returns

mixed

Defined by Zend\Filter\Filter

filter(string|array $value) : string | array

Renames the file $value to the new name set before Returns the file $value, removing all but digit characters

Parameters

$value

stringarray

Full path of file to change or $_FILES data array

Exceptions

\Zend\Filter\Exception\RuntimeException

Returns

stringarrayThe new filename which has been set, or false when there were errors

Retrieve options representing object state

getOptions() : array
Inherited

Returns

array

getOverwrite()

getOverwrite() : boolean

Returns

boolean

getRandomize()

getRandomize() : boolean

Returns

boolean

getTarget()

getTarget() : string

Returns

stringTarget file path or directory

getUseUploadExtension()

getUseUploadExtension() : boolean

Returns

boolean

getUseUploadName()

getUseUploadName() : boolean

Returns

boolean

hasPcreUnicodeSupport()

hasPcreUnicodeSupport() : boolean
InheritedStatic
deprecated Since 2.1.0

Returns

boolean

setOptions()

setOptions(array|\Traversable $options) : \Zend\Filter\File\RenameUpload
Inherited
fluent This method is part of a fluent interface and will return the same instance

Parameters

$options

array\Traversable

Exceptions

\Zend\Filter\Exception\InvalidArgumentException

Returns

\Zend\Filter\File\RenameUpload

setOverwrite()

setOverwrite(boolean $flag = true) : \Zend\Filter\File\RenameUpload
fluent This method is part of a fluent interface and will return the same instance

Parameters

$flag

boolean

Shall existing files be overwritten?

Returns

\Zend\Filter\File\RenameUpload

setRandomize()

setRandomize(boolean $flag = true) : \Zend\Filter\File\RenameUpload
fluent This method is part of a fluent interface and will return the same instance

Parameters

$flag

boolean

Shall target files have a random postfix attached?

Returns

\Zend\Filter\File\RenameUpload

setTarget()

setTarget(string $target) : \Zend\Filter\File\RenameUpload
fluent This method is part of a fluent interface and will return the same instance

Parameters

$target

string

Target file path or directory

Returns

\Zend\Filter\File\RenameUpload

setUseUploadExtension()

setUseUploadExtension(boolean $flag = true) : \Zend\Filter\File\RenameUpload
fluent This method is part of a fluent interface and will return the same instance

Parameters

$flag

boolean

When true, this filter will use the original file extension for the target filename

Returns

\Zend\Filter\File\RenameUpload

setUseUploadName()

setUseUploadName(boolean $flag = true) : \Zend\Filter\File\RenameUpload
fluent This method is part of a fluent interface and will return the same instance

Parameters

$flag

boolean

When true, this filter will use the $_FILES['name'] as the target filename. Otherwise, it uses the default 'target' rules.

Returns

\Zend\Filter\File\RenameUpload

applyRandomToFilename()

applyRandomToFilename(string $source, string $filename) : string

Parameters

$source

string

$filename

string

Returns

string

checkFileExists()

checkFileExists(string $targetFile) 

Parameters

$targetFile

string

Target file path

Exceptions

\Zend\Filter\Exception\InvalidArgumentException

getFinalTarget()

getFinalTarget(array $uploadData) : string

Parameters

$uploadData

array

$_FILES array

Returns

string

isOptions()

isOptions(mixed $options) : boolean
InheritedStatic

Parameters

$options

mixed

Returns

boolean

moveUploadedFile()

moveUploadedFile(string $sourceFile, string $targetFile) : boolean

Parameters

$sourceFile

string

Source file path

$targetFile

string

Target file path

Exceptions

\Zend\Filter\Exception\RuntimeException

Returns

boolean

 Properties

 

Store already filtered values, so we can filter multiple times the same file without being block by move_uploaded_file internal checks

$alreadyFiltered : array

Default

array()
 

Filter options

$options : array

Default

array('target' => null, 'use_upload_name' => false, 'use_upload_extension' => false, 'overwrite' => false, 'randomize' => false)
inherited_from \Zend\Filter\AbstractFilter::options
 

Filter options

$options : array

Default

array()