Skip to content

Commit deac0c3

Browse files
jderusseJérémy Derussé
authored and
Jérémy Derussé
committed
Add option binaryFormat in constraint file
1 parent e3acdc5 commit deac0c3

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

reference/constraints/File.rst

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ form type.
2020
| Applies to | :ref:`property or method <validation-property-target>` |
2121
+----------------+---------------------------------------------------------------------+
2222
| Options | - `maxSize`_ |
23+
| | - `binaryFormat`_ |
2324
| | - `mimeTypes`_ |
2425
| | - `maxSizeMessage`_ |
2526
| | - `mimeTypesMessage`_ |
@@ -78,7 +79,7 @@ below a certain file size and a valid PDF, add the following:
7879
maxSize: 1024k
7980
mimeTypes: [application/pdf, application/x-pdf]
8081
mimeTypesMessage: Please upload a valid PDF
81-
82+
8283
8384
.. code-block:: php-annotations
8485
@@ -151,6 +152,18 @@ have been specified.
151152
Options
152153
-------
153154

155+
.. versionadded:: 2.6
156+
The ``binaryFormat`` option was introduced in Symfony 2.6.
157+
158+
binaryFormat
159+
~~~~~~~~~~~~
160+
161+
**type**: ``boolean`` **default**: ``null``
162+
163+
When true, the sizes will be displayed in messages with binary suffixes (KiB, MiB).
164+
When false, the sizes will be displayed with SI suffixes (kB, MB).
165+
When null, then the binaryFormat will be guessed from the suffix defined in the maxSize option.
166+
154167
maxSize
155168
~~~~~~~
156169

0 commit comments

Comments
 (0)