|Class name||Short alias||Description|
||Renames/moves an arbitrary file.|
||Renames/moves the uploaded file with security checks.|
||Encrypts a given file and stores the encrypted file content.|
||Decrypts a given file and stores the decrypted file content.|
||Converts file content to lower case letters.|
||Converts file content to upper case letters.|
From the table, you can see that filters can be divided into the following groups:
Please note that since file filters live in
Zend\Filter\Filenamespace, their short aliases (that you use when creating a filter with the factory) start with
Fileprefix. For example, the
Decrypt filters allow to apply various encryption/decryption algorithms
to the uploaded file (concrete algorithm is attached by specifying the certain adapter). The
UpperCase filters are suitable for converting text files to lower- and upper-case, respectively 43.
43) In the author's opinion, the above mentioned four filters are not very useful when working with uploaded files, because you rarely need to encrypt an uploaded file or convert it to lower case letters.
Rename filter allows to rename and/or move an arbitrary file (not only uploaded file).
It uses the
rename() PHP function internally, and that's why it is in general not recommended
to use this filter with uploaded files because of security reasons.
RenameUpload filter seems to be much more useful than other filters, because it allows to encapsulate
the call of the
move_uploaded_file() function and move/rename the uploaded file from a temporary location
to its persistent directory. We will show how to use the
RenameUpload filter in the Image Gallery
code example later in this chapter.