Skip to content

Commit 6f81e6e

Browse files
authored
Merge pull request #7969 from dgvirtual/add_fileValidation_explanation
Add note that only file rules can be used to validate files
2 parents 652bb44 + fde934e commit 6f81e6e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

user_guide_src/source/libraries/validation.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -974,6 +974,9 @@ Rule Parameter Description
974974
======================= ========== ============================================= ===================================================
975975
uploaded Yes Fails if the name of the parameter does not ``uploaded[field_name]``
976976
match the name of any uploaded files.
977+
If you want the file upload to be optional
978+
(not required), do not define this rule.
979+
977980
max_size Yes Fails if the uploaded file named in the ``max_size[field_name,2048]``
978981
parameter is larger than the second
979982
parameter in kilobytes (kb). Or if the file
@@ -995,3 +998,7 @@ is_image Yes Fails if the file cannot be determined to be
995998
======================= ========== ============================================= ===================================================
996999

9971000
The file validation rules apply for both single and multiple file uploads.
1001+
1002+
.. note:: Only rules specifically created for file validation (like the ones listed in the table above) can be used to validate files.
1003+
Therefore, adding any general rules, like ``permit_empty``, to file validation rules array or string, the file validation will not
1004+
work correctly.

0 commit comments

Comments
 (0)