Skip to content

Commit

Permalink
Merge pull request codeigniter4#7969 from dgvirtual/add_fileValidatio…
Browse files Browse the repository at this point in the history
…n_explanation

Add note that only file rules can be used to validate files
  • Loading branch information
kenjis authored Oct 24, 2023
2 parents 652bb44 + fde934e commit 6f81e6e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions user_guide_src/source/libraries/validation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -974,6 +974,9 @@ Rule Parameter Description
======================= ========== ============================================= ===================================================
uploaded Yes Fails if the name of the parameter does not ``uploaded[field_name]``
match the name of any uploaded files.
If you want the file upload to be optional
(not required), do not define this rule.

max_size Yes Fails if the uploaded file named in the ``max_size[field_name,2048]``
parameter is larger than the second
parameter in kilobytes (kb). Or if the file
Expand All @@ -995,3 +998,7 @@ is_image Yes Fails if the file cannot be determined to be
======================= ========== ============================================= ===================================================

The file validation rules apply for both single and multiple file uploads.

.. note:: Only rules specifically created for file validation (like the ones listed in the table above) can be used to validate files.
Therefore, adding any general rules, like ``permit_empty``, to file validation rules array or string, the file validation will not
work correctly.

0 comments on commit 6f81e6e

Please sign in to comment.