|
|
@@ -39,9 +39,9 @@
|
|
|
|
|
|
<listitem>
|
|
|
<para>
|
|
|
- <code>ExcludeMimeType</code>: This validator validates the <acronym>MIME</acronym> type of files. It
|
|
|
- can also validate <acronym>MIME</acronym> types and will throw an error if the <acronym>MIME</acronym> type of specified
|
|
|
- file matches.
|
|
|
+ <code>ExcludeMimeType</code>: This validator validates the <acronym>MIME</acronym>
|
|
|
+ type of files. It can also validate <acronym>MIME</acronym> types and will throw an
|
|
|
+ error if the <acronym>MIME</acronym> type of specified file matches.
|
|
|
</para>
|
|
|
</listitem>
|
|
|
|
|
|
@@ -108,9 +108,9 @@
|
|
|
|
|
|
<listitem>
|
|
|
<para>
|
|
|
- <code>MimeType</code>: This validator validates the <acronym>MIME</acronym> type of files. It can also
|
|
|
- validate <acronym>MIME</acronym> types and will throw an error if the <acronym>MIME</acronym> type of a specified
|
|
|
- file does not match.
|
|
|
+ <code>MimeType</code>: This validator validates the <acronym>MIME</acronym> type of
|
|
|
+ files. It can also validate <acronym>MIME</acronym> types and will throw an error if
|
|
|
+ the <acronym>MIME</acronym> type of a specified file does not match.
|
|
|
</para>
|
|
|
</listitem>
|
|
|
|
|
|
@@ -436,8 +436,8 @@ $upload->addValidator('Count', false, array('min' =>1, 'max' => 5));
|
|
|
|
|
|
<para>
|
|
|
The <code>Crc32</code> validator checks the content of a transferred file by hashing it.
|
|
|
- This validator uses the hash extension from <acronym>PHP</acronym> with the crc32 algorithm.
|
|
|
- It supports the following options:
|
|
|
+ This validator uses the hash extension from <acronym>PHP</acronym> with the crc32
|
|
|
+ algorithm. It supports the following options:
|
|
|
</para>
|
|
|
|
|
|
<itemizedlist>
|
|
|
@@ -542,29 +542,30 @@ $upload->addValidator('ExcludeExtension',
|
|
|
<title>ExcludeMimeType Validator</title>
|
|
|
|
|
|
<para>
|
|
|
- The <code>ExcludeMimeType</code> validator checks the <acronym>MIME</acronym> type of transferred files.
|
|
|
- It supports the following options:
|
|
|
+ The <code>ExcludeMimeType</code> validator checks the <acronym>MIME</acronym> type of
|
|
|
+ transferred files. It supports the following options:
|
|
|
</para>
|
|
|
|
|
|
<itemizedlist>
|
|
|
<listitem>
|
|
|
<para>
|
|
|
- <code>*</code>: Sets any key individually or use a numeric array. Sets the <acronym>MIME</acronym>
|
|
|
- type to validate against.
|
|
|
+ <code>*</code>: Sets any key individually or use a numeric array. Sets the
|
|
|
+ <acronym>MIME</acronym> type to validate against.
|
|
|
</para>
|
|
|
|
|
|
<para>
|
|
|
- With this option you can define the <acronym>MIME</acronym> type of files that are not to be
|
|
|
- accepted.
|
|
|
+ With this option you can define the <acronym>MIME</acronym> type of files that
|
|
|
+ are not to be accepted.
|
|
|
</para>
|
|
|
</listitem>
|
|
|
</itemizedlist>
|
|
|
|
|
|
<para>
|
|
|
- This validator accepts multiple <acronym>MIME</acronym> types, either as a comma-delimited string, or as
|
|
|
- an array. You may also use the methods <methodname>setMimeType()</methodname>,
|
|
|
- <methodname>addMimeType()</methodname>, and <methodname>getMimeType()</methodname> to
|
|
|
- set and retrieve the <acronym>MIME</acronym> types.
|
|
|
+ This validator accepts multiple <acronym>MIME</acronym> types, either as a
|
|
|
+ comma-delimited string, or as an array. You may also use the methods
|
|
|
+ <methodname>setMimeType()</methodname>, <methodname>addMimeType()</methodname>, and
|
|
|
+ <methodname>getMimeType()</methodname> to set and retrieve the <acronym>MIME</acronym>
|
|
|
+ types.
|
|
|
</para>
|
|
|
|
|
|
<example id="zend.file.transfer.validators.excludemimetype.example">
|
|
|
@@ -586,18 +587,19 @@ $upload->addValidator('ExcludeMimeType', false, 'image');
|
|
|
</example>
|
|
|
|
|
|
<para>
|
|
|
- The above example shows that it is also possible to disallow groups of <acronym>MIME</acronym> types.
|
|
|
- For example, to disallow all images, just use 'image' as the <acronym>MIME</acronym> type. This can be used
|
|
|
- for all groups of <acronym>MIME</acronym> types like 'image', 'audio', 'video', 'text', etc.
|
|
|
+ The above example shows that it is also possible to disallow groups of
|
|
|
+ <acronym>MIME</acronym> types. For example, to disallow all images, just use 'image' as
|
|
|
+ the <acronym>MIME</acronym> type. This can be used for all groups of
|
|
|
+ <acronym>MIME</acronym> types like 'image', 'audio', 'video', 'text', etc.
|
|
|
</para>
|
|
|
|
|
|
<note>
|
|
|
<para>
|
|
|
- Note that disallowing groups of <acronym>MIME</acronym> types will disallow all members of this group
|
|
|
- even if this is not intentional. When you disallow 'image' you will disallow all
|
|
|
- types of images like 'image/jpeg' or 'image/vasa'. When you are not sure if you want
|
|
|
- to disallow all types, you should disallow only specific <acronym>MIME</acronym> types instead of
|
|
|
- complete groups.
|
|
|
+ Note that disallowing groups of <acronym>MIME</acronym> types will disallow all
|
|
|
+ members of this group even if this is not intentional. When you disallow 'image' you
|
|
|
+ will disallow all types of images like 'image/jpeg' or 'image/vasa'. When you are
|
|
|
+ not sure if you want to disallow all types, you should disallow only specific
|
|
|
+ <acronym>MIME</acronym> types instead of complete groups.
|
|
|
</para>
|
|
|
</note>
|
|
|
</sect2>
|
|
|
@@ -840,16 +842,18 @@ $upload->addValidator('FilesSize',
|
|
|
</itemizedlist>
|
|
|
|
|
|
<para>
|
|
|
- The methods <methodname>setImageMin()</methodname> and <methodname>setImageMax()</methodname> also set
|
|
|
- both minimum and maximum values, while the methods <methodname>getMin()</methodname> and
|
|
|
- <methodname>getMax()</methodname> return the currently set values.
|
|
|
+ The methods <methodname>setImageMin()</methodname> and
|
|
|
+ <methodname>setImageMax()</methodname> also set both minimum and maximum values, while
|
|
|
+ the methods <methodname>getMin()</methodname> and <methodname>getMax()</methodname>
|
|
|
+ return the currently set values.
|
|
|
</para>
|
|
|
|
|
|
<para>
|
|
|
For your convenience there are also the <methodname>setImageWidth()</methodname> and
|
|
|
- <methodname>setImageHeight()</methodname> methods, which set the minimum and maximum height and
|
|
|
- width of the image file. They, too, have corresponding <methodname>getImageWidth()</methodname> and
|
|
|
- <methodname>getImageHeight()</methodname> methods to retrieve the currently set values.
|
|
|
+ <methodname>setImageHeight()</methodname> methods, which set the minimum and maximum
|
|
|
+ height and width of the image file. They, too, have corresponding
|
|
|
+ <methodname>getImageWidth()</methodname> and <methodname>getImageHeight()</methodname>
|
|
|
+ methods to retrieve the currently set values.
|
|
|
</para>
|
|
|
|
|
|
<para>
|
|
|
@@ -907,10 +911,10 @@ $upload->addValidator('IsCompressed', false, 'zip');
|
|
|
|
|
|
<note>
|
|
|
<para>
|
|
|
- Note that there is no check if you set a <acronym>MIME</acronym> type that is not a archive. For
|
|
|
- example, it would be possible to define gif files to be accepted by this validator.
|
|
|
- Using the 'MimeType' validator for files which are not archived will result in more
|
|
|
- readable code.
|
|
|
+ Note that there is no check if you set a <acronym>MIME</acronym> type that is not a
|
|
|
+ archive. for example, it would be possible to define gif files to be accepted by
|
|
|
+ this validator. Using the 'MimeType' validator for files which are not archived will
|
|
|
+ result in more readable code.
|
|
|
</para>
|
|
|
</note>
|
|
|
</sect2>
|
|
|
@@ -944,10 +948,10 @@ $upload->addValidator('IsImage', false, 'jpeg');
|
|
|
|
|
|
<note>
|
|
|
<para>
|
|
|
- Note that there is no check if you set a <acronym>MIME</acronym> type that is not an image. For
|
|
|
- example, it would be possible to define zip files to be accepted by this validator.
|
|
|
- Using the 'MimeType' validator for files which are not images will result in more
|
|
|
- readable code.
|
|
|
+ Note that there is no check if you set a <acronym>MIME</acronym> type that is not an
|
|
|
+ image. for example, it would be possible to define zip files to be accepted by this
|
|
|
+ validator. Using the 'MimeType' validator for files which are not images will result
|
|
|
+ in more readable code.
|
|
|
</para>
|
|
|
</note>
|
|
|
</sect2>
|
|
|
@@ -957,7 +961,8 @@ $upload->addValidator('IsImage', false, 'jpeg');
|
|
|
|
|
|
<para>
|
|
|
The <code>Hash</code> validator checks the content of a transferred file by hashing it.
|
|
|
- This validator uses the hash extension from <acronym>PHP</acronym>. It supports the following options:
|
|
|
+ This validator uses the hash extension from <acronym>PHP</acronym>. It supports the
|
|
|
+ following options:
|
|
|
</para>
|
|
|
|
|
|
<itemizedlist>
|
|
|
@@ -979,8 +984,8 @@ $upload->addValidator('IsImage', false, 'jpeg');
|
|
|
</para>
|
|
|
|
|
|
<para>
|
|
|
- You can set multiple algorithm by calling the <methodname>addHash()</methodname> method
|
|
|
- multiple times.
|
|
|
+ You can set multiple algorithm by calling the <methodname>addHash()</methodname>
|
|
|
+ method multiple times.
|
|
|
</para>
|
|
|
</listitem>
|
|
|
</itemizedlist>
|
|
|
@@ -1020,8 +1025,8 @@ $upload->addValidator('Hash',
|
|
|
|
|
|
<para>
|
|
|
The <code>Md5</code> validator checks the content of a transferred file by hashing it.
|
|
|
- This validator uses the hash extension for <acronym>PHP</acronym> with the md5 algorithm.
|
|
|
- It supports the following options:
|
|
|
+ This validator uses the hash extension for <acronym>PHP</acronym> with the md5
|
|
|
+ algorithm. It supports the following options:
|
|
|
</para>
|
|
|
|
|
|
<itemizedlist>
|
|
|
@@ -1059,15 +1064,15 @@ $upload->addValidator('Md5',
|
|
|
<title>MimeType Validator</title>
|
|
|
|
|
|
<para>
|
|
|
- The <code>MimeType</code> validator checks the <acronym>MIME</acronym> type of transferred files.
|
|
|
- It supports the following options:
|
|
|
+ The <code>MimeType</code> validator checks the <acronym>MIME</acronym> type of
|
|
|
+ transferred files. It supports the following options:
|
|
|
</para>
|
|
|
|
|
|
<itemizedlist>
|
|
|
<listitem>
|
|
|
<para>
|
|
|
- <code>*</code>: Sets any key or use a numeric array. Sets the <acronym>MIME</acronym> type to
|
|
|
- validate against.
|
|
|
+ <code>*</code>: Sets any key or use a numeric array. Sets the
|
|
|
+ <acronym>MIME</acronym> type to validate against.
|
|
|
</para>
|
|
|
|
|
|
<para>
|
|
|
@@ -1089,17 +1094,18 @@ $upload->addValidator('Md5',
|
|
|
</itemizedlist>
|
|
|
|
|
|
<para>
|
|
|
- This validator accepts multiple <acronym>MIME</acronym> type, either as a comma-delimited string, or as an
|
|
|
- array. You may also use the methods <methodname>setMimeType()</methodname>,
|
|
|
- <methodname>addMimeType()</methodname>, and <methodname>getMimeType()</methodname> to set and retrieve <acronym>MIME</acronym>
|
|
|
+ This validator accepts multiple <acronym>MIME</acronym> type, either as a
|
|
|
+ comma-delimited string, or as an array. You may also use the methods
|
|
|
+ <methodname>setMimeType()</methodname>, <methodname>addMimeType()</methodname>, and
|
|
|
+ <methodname>getMimeType()</methodname> to set and retrieve <acronym>MIME</acronym>
|
|
|
type.
|
|
|
</para>
|
|
|
|
|
|
<para>
|
|
|
You can also set the magicfile which shall be used by fileinfo with the 'magicfile'
|
|
|
option. Additionally there are convenient <methodname>setMagicFile()</methodname> and
|
|
|
- <methodname>getMagicFile()</methodname> methods which allow later setting and retrieving of the
|
|
|
- magicfile parameter. This methods are available since Zend Framework 1.7.1.
|
|
|
+ <methodname>getMagicFile()</methodname> methods which allow later setting and retrieving
|
|
|
+ of the magicfile parameter. This methods are available since Zend Framework 1.7.1.
|
|
|
</para>
|
|
|
|
|
|
<example id="zend.file.transfer.validators.mimetype.example">
|
|
|
@@ -1126,18 +1132,19 @@ $upload->addValidator('MimeType',
|
|
|
</example>
|
|
|
|
|
|
<para>
|
|
|
- The above example shows that it is also possible to limit the accepted <acronym>MIME</acronym> type to a
|
|
|
- group of <acronym>MIME</acronym> types. To allow all images just use 'image' as <acronym>MIME</acronym> type. This can be used
|
|
|
- for all groups of <acronym>MIME</acronym> types like 'image', 'audio', 'video', 'text, and so on.
|
|
|
+ The above example shows that it is also possible to limit the accepted
|
|
|
+ <acronym>MIME</acronym> type to a group of <acronym>MIME</acronym> types. To allow all
|
|
|
+ images just use 'image' as <acronym>MIME</acronym> type. This can be used for all groups
|
|
|
+ of <acronym>MIME</acronym> types like 'image', 'audio', 'video', 'text, and so on.
|
|
|
</para>
|
|
|
|
|
|
<note>
|
|
|
<para>
|
|
|
- Note that allowing groups of <acronym>MIME</acronym> types will accept all members of this group even
|
|
|
- if your application does not support them. When you allow 'image' you will also get
|
|
|
- 'image/xpixmap' or 'image/vasa' which could be problematic. When you are not sure if
|
|
|
- your application supports all types you should better allow only defined <acronym>MIME</acronym> types
|
|
|
- instead of the complete group.
|
|
|
+ Note that allowing groups of <acronym>MIME</acronym> types will accept all members
|
|
|
+ of this group even if your application does not support them. When you allow 'image'
|
|
|
+ you will also get 'image/xpixmap' or 'image/vasa' which could be problematic. When
|
|
|
+ you are not sure if your application supports all types you should better allow only
|
|
|
+ defined <acronym>MIME</acronym> types instead of the complete group.
|
|
|
</para>
|
|
|
</note>
|
|
|
|
|
|
@@ -1145,13 +1152,15 @@ $upload->addValidator('MimeType',
|
|
|
<para>
|
|
|
This component will use the <code>fileinfo</code> extension if it is available. If
|
|
|
it's not, it will degrade to the <code>mime_content_type</code> function. And if the
|
|
|
- function call fails it will use the <acronym>MIME</acronym> type which is given by <acronym>HTTP</acronym>.
|
|
|
+ function call fails it will use the <acronym>MIME</acronym> type which is given by
|
|
|
+ <acronym>HTTP</acronym>.
|
|
|
</para>
|
|
|
|
|
|
<para>
|
|
|
You should be aware of possible security problems when you have whether
|
|
|
- <code>fileinfo</code> nor <code>mime_content_type</code> available. The <acronym>MIME</acronym> type
|
|
|
- given by <acronym>HTTP</acronym> is not secure and can be easily manipulated.
|
|
|
+ <code>fileinfo</code> nor <code>mime_content_type</code> available. The
|
|
|
+ <acronym>MIME</acronym> type given by <acronym>HTTP</acronym> is not secure and can
|
|
|
+ be easily manipulated.
|
|
|
</para>
|
|
|
</note>
|
|
|
</sect2>
|
|
|
@@ -1176,8 +1185,8 @@ $upload->addValidator('MimeType',
|
|
|
<para>
|
|
|
This validator accepts multiple directories either as a comma-delimited string, or as an
|
|
|
array. You may also use the methods <methodname>setDirectory()</methodname>,
|
|
|
- <methodname>addDirectory()</methodname>, and <methodname>getDirectory()</methodname> to set and retrieve
|
|
|
- directories.
|
|
|
+ <methodname>addDirectory()</methodname>, and <methodname>getDirectory()</methodname> to
|
|
|
+ set and retrieve directories.
|
|
|
</para>
|
|
|
|
|
|
<example id="zend.file.transfer.validators.notexists.example">
|
|
|
@@ -1211,8 +1220,8 @@ $upload->addValidator('NotExists', false,
|
|
|
|
|
|
<para>
|
|
|
The <code>Sha1</code> validator checks the content of a transferred file by hashing it.
|
|
|
- This validator uses the hash extension for <acronym>PHP</acronym> with the sha1 algorithm.
|
|
|
- It supports the following options:
|
|
|
+ This validator uses the hash extension for <acronym>PHP</acronym> with the sha1
|
|
|
+ algorithm. It supports the following options:
|
|
|
</para>
|
|
|
|
|
|
<itemizedlist>
|
|
|
@@ -1281,10 +1290,10 @@ $upload->addValidator('Sha1',
|
|
|
|
|
|
<para>
|
|
|
You can initialize this validator with a string, which will then be used to set the
|
|
|
- <code>max</code> option. You can also use the methods <methodname>setMin()</methodname> and
|
|
|
- <methodname>setMax()</methodname> to set both options after construction, along with
|
|
|
- <methodname>getMin()</methodname> and <methodname>getMax()</methodname> to retrieve the values that have been
|
|
|
- set previously.
|
|
|
+ <code>max</code> option. You can also use the methods <methodname>setMin()</methodname>
|
|
|
+ and <methodname>setMax()</methodname> to set both options after construction, along with
|
|
|
+ <methodname>getMin()</methodname> and <methodname>getMax()</methodname> to retrieve the
|
|
|
+ values that have been set previously.
|
|
|
</para>
|
|
|
|
|
|
<para>
|
|
|
@@ -1342,8 +1351,9 @@ $upload->addValidator('Size',
|
|
|
<para>
|
|
|
If you initiate this validator with a string or integer, the value will be used as
|
|
|
<code>max</code>. Or you can also use the methods <methodname>setMin()</methodname> and
|
|
|
- <methodname>setMax()</methodname> to set both options afterwards and <methodname>getMin()</methodname> and
|
|
|
- <methodname>getMax()</methodname> to retrieve the actual set values.
|
|
|
+ <methodname>setMax()</methodname> to set both options afterwards and
|
|
|
+ <methodname>getMin()</methodname> and <methodname>getMax()</methodname> to retrieve the
|
|
|
+ actual set values.
|
|
|
</para>
|
|
|
|
|
|
<example id="zend.file.transfer.validators.wordcount.example">
|