Permalink
Browse files

feature #3746 [Validator] Disallow empty file in FileValidator (megaz…

…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 2ae4f34a1e0afe699ccaacf2740440a0752a9a99
Showing with 13 additions and 0 deletions.
  1. +13 −0 reference/constraints/File.rst
@@ -23,6 +23,7 @@ form type.
| | - `mimeTypes`_ |
| | - `maxSizeMessage`_ |
| | - `mimeTypesMessage`_ |
| | - `disallowEmptyMessage`_ |
| | - `notFoundMessage`_ |
| | - `notReadableMessage`_ |
| | - `uploadIniSizeErrorMessage`_ |
@@ -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
~~~~~~~~~~~~~~~

0 comments on commit 2ae4f34

Please sign in to comment.