Skip to content

Commit

Permalink
feature #3746 [Validator] Disallow empty file in FileValidator (megaz…
Browse files Browse the repository at this point in the history
…oll)

This PR was merged into the master branch.

Discussion
----------

[Validator] Disallow empty file in FileValidator

| Q             | A
| ------------- | ---
| Doc fix?      | no
| New docs?     | yes (symfony/symfony#11125)
| Applies to    | 2.6+

Commits
-------

80673d5 Disallow empty file in FileValidator
  • Loading branch information
weaverryan committed Jul 3, 2014
2 parents 1805aa9 + 80673d5 commit 2ae4f34
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions reference/constraints/File.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ form type.
| | - `mimeTypes`_ |
| | - `maxSizeMessage`_ |
| | - `mimeTypesMessage`_ |
| | - `disallowEmptyMessage`_ |
| | - `notFoundMessage`_ |
| | - `notReadableMessage`_ |
| | - `uploadIniSizeErrorMessage`_ |
Expand Down Expand Up @@ -194,6 +195,18 @@ mimeTypesMessage
The message displayed if the mime type of the file is not a valid mime type
per the `mimeTypes`_ option.

disallowEmptyMessage
~~~~~~~~~~~~~~~~~~~~

.. versionadded:: 2.6
The ``disallowEmptyMessage`` option was introduced in Symfony 2.6. Prior to 2.6,
if the user uploaded an empty file, no validation error occurred.

**type**: ``string`` **default**: ``An empty file is not allowed.``

This constraint checks if the uploaded file is empty (i.e. 0 bytes). If it is,
this message is displayed.

notFoundMessage
~~~~~~~~~~~~~~~

Expand Down

0 comments on commit 2ae4f34

Please sign in to comment.