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()

inherited_from \Zend\Filter\AbstractFilter::__invoke()

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

inherited_from \Zend\Filter\AbstractFilter::getOptions()

Returns

array

getOverwrite()

getOverwrite() : bool

Returns

bool

getRandomize()

getRandomize() : bool

Returns

bool

getTarget()

getTarget() : string

Returns

stringTarget file path or directory

getUseUploadExtension()

getUseUploadExtension() : bool

Returns

bool

getUseUploadName()

getUseUploadName() : bool

Returns

bool

hasPcreUnicodeSupport()

hasPcreUnicodeSupport() : bool
Inherited

inherited_from \Zend\Filter\AbstractFilter::hasPcreUnicodeSupport()

Returns

bool

setOptions()

setOptions(array | \Traversable $options) : \Zend\Filter\self
Inherited

inherited_from \Zend\Filter\AbstractFilter::setOptions()

Parameters

$options

array\Traversable

Exceptions

\Zend\Filter\Exception\InvalidArgumentException

Returns

\Zend\Filter\self

setOverwrite()

setOverwrite(bool $flag) : \Zend\Filter\File\self

Parameters

$flag

bool

Shall existing files be overwritten?

Returns

\Zend\Filter\File\self

setRandomize()

setRandomize(bool $flag) : \Zend\Filter\File\self

Parameters

$flag

bool

Shall target files have a random postfix attached?

Returns

\Zend\Filter\File\self

setTarget()

setTarget(string $target) : \Zend\Filter\File\self

Parameters

$target

string

Target file path or directory

Returns

\Zend\Filter\File\self

setUseUploadExtension()

setUseUploadExtension(bool $flag) : \Zend\Filter\File\self

Parameters

$flag

bool

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

Returns

\Zend\Filter\File\self

setUseUploadName()

setUseUploadName(bool $flag) : \Zend\Filter\File\self

Parameters

$flag

bool

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

Returns

\Zend\Filter\File\self

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) : bool
Inherited

inherited_from \Zend\Filter\AbstractFilter::isOptions()

Parameters

$options

mixed

Returns

bool

moveUploadedFile()

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

Parameters

$sourceFile

string

Source file path

$targetFile

string

Target file path

Exceptions

\Zend\Filter\Exception\RuntimeException

Returns

bool

 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

 

Filter options

$options : array