From 8b8bba7c448620557f51ac557f342ef5b700239e Mon Sep 17 00:00:00 2001 From: Vyacheslav Salakhutdinov Date: Fri, 21 Mar 2014 08:31:38 +0000 Subject: [PATCH] Added minSize option to File constraint --- reference/constraints/File.rst | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/reference/constraints/File.rst b/reference/constraints/File.rst index 683d0fe6a49..07ec24bbeef 100644 --- a/reference/constraints/File.rst +++ b/reference/constraints/File.rst @@ -20,8 +20,10 @@ form type. | Applies to | :ref:`property or method ` | +----------------+---------------------------------------------------------------------+ | Options | - `maxSize`_ | +| | - `minSize`_ | | | - `mimeTypes`_ | | | - `maxSizeMessage`_ | +| | - `minSizeMessage`_ | | | - `mimeTypesMessage`_ | | | - `notFoundMessage`_ | | | - `notReadableMessage`_ | @@ -78,7 +80,7 @@ below a certain file size and a valid PDF, add the following: maxSize: 1024k mimeTypes: [application/pdf, application/x-pdf] mimeTypesMessage: Please upload a valid PDF - + .. code-block:: php-annotations @@ -168,6 +170,23 @@ to be valid. The size of the file can be given in one of the following formats: * **megabytes**: To specify the ``maxSize`` in megabytes, pass a number and suffix it with a capital "M" (e.g. ``4M``). +minSize +~~~~~~~ + +**type**: ``mixed`` + +If set, the size of the underlying file must be above this file size in order +to be valid. The size of the file can be given in one of the following formats: + +* **bytes**: To specify the ``minSize`` in bytes, pass a value that is entirely + numeric (e.g. ``4096``); + +* **kilobytes**: To specify the ``minSize`` in kilobytes, pass a number and + suffix it with a lowercase "k" (e.g. ``200k``); + +* **megabytes**: To specify the ``minSize`` in megabytes, pass a number and + suffix it with a capital "M" (e.g. ``4M``). + mimeTypes ~~~~~~~~~ @@ -186,6 +205,13 @@ maxSizeMessage The message displayed if the file is larger than the `maxSize`_ option. +minSizeMessage +~~~~~~~~~~~~~~ + +**type**: ``string`` **default**: ``The file is too small ({{ size }} {{ suffix }}). Allowed minimum size is {{ limit }} {{ suffix }}.`` + +The message displayed if the file is smaller than the `minSize`_ option. + mimeTypesMessage ~~~~~~~~~~~~~~~~