8000 feature #3746 [Validator] Disallow empty file in FileValidator (megaz… · danielsan/symfony-docs@2ae4f34 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2ae4f34

Browse files
committed
feature symfony#3746 [Validator] Disallow empty file in FileValidator (megazoll)
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
2 parents 1805aa9 + 80673d5 commit 2ae4f34

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

reference/constraints/File.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ form type.
2323
| | - `mimeTypes`_ |
2424
| | - `maxSizeMessage`_ |
2525
| | - `mimeTypesMessage`_ |
26+
| | - `disallowEmptyMessage`_ |
2627
| | - `notFoundMessage`_ |
2728
| | - `notReadableMessage`_ |
2829
| | - `uploadIniSizeErrorMessage`_ |
@@ -194,6 +195,18 @@ mimeTypesMessage
194195
The message displayed if the mime type of the file is not a valid mime type
195196
per the `mimeTypes`_ option.
196197

198+
disallowEmptyMessage
199+
~~~~~~~~~~~~~~~~~~~~
200+
201+
.. versionadded:: 2.6
202+
The ``disallowEmptyMessage`` option was introduced in Symfony 2.6. Prior to 2.6,
203+
if the user uploaded an empty file, no validation error occurred.
204+
205+
**type**: ``string`` **default**: ``An empty file is not allowed.``
206+
207+
This constraint checks if the uploaded file is empty (i.e. 0 bytes). If it is,
208+
this message is displayed.
209+
197210
notFoundMessage
198211
~~~~~~~~~~~~~~~
199212

0 commit comments

Comments
 (0)
0