Skip to content

[Validator] Disallow empty file in FileValidator #3746

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 3, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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