From 80673d58627435aeab3d0daa0891205c2306b344 Mon Sep 17 00:00:00 2001 From: Vyacheslav Salakhutdinov Date: Mon, 23 Jun 2014 05:23:37 +0000 Subject: [PATCH] Disallow empty file in FileValidator --- reference/constraints/File.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/reference/constraints/File.rst b/reference/constraints/File.rst index 683d0fe6a49..c06a20fd71b 100644 --- a/reference/constraints/File.rst +++ b/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 ~~~~~~~~~~~~~~~