Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1a1fb8f

Browse files
[Validator] Add the option filenameMaxLength to the File constraint
1 parent ad55b0d commit 1a1fb8f

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

reference/constraints/File.rst

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,38 @@ You can find a list of existing mime types on the `IANA website`_.
268268
(i.e. the form type is not defined explicitly in the ``->add()`` method of
269269
the form builder) and when the field doesn't define its own ``accept`` value.
270270

271+
``filenameMaxLength``
272+
~~~~~~~~~~~~~~~~~~~~~
273+
274+
**type**: ``integer`` **default**: ``null``
275+
276+
.. versionadded:: 6.3
277+
278+
The ``filenameMaxLength`` was introduced in Symfony 6.3.
279+
280+
If set, the validator will check that the filename of the underlying file
281+
doesn't exceed a certain length.
282+
283+
``filenameTooLongMessage``
284+
~~~~~~~~~~~~~~~~~~~~~~~~~~
285+
286+
**type**: ``string`` **default**: ``The filename is too long. It should have {{ filename_max_length }} character or less.|The filename is too long. It should have {{ filename_max_length }} characters or less.``
287+
288+
.. versionadded:: 6.3
289+
290+
The ``filenameTooLongMessage`` was introduced in Symfony 6.3.
291+
292+
The message displayed if the filename of the file exceeds the limit set
293+
with the ``filenameMaxLength`` option.
294+
295+
You can use the following parameters in this message:
296+
297+
============================== ==============================================================
298+
Parameter Description
299+
============================== ==============================================================
300+
``{{ filename_max_length }}`` Maximum number of characters allowed
301+
============================== ==============================================================
302+
271303
``extensionsMessage``
272304
~~~~~~~~~~~~~~~~~~~~~
273305

0 commit comments

Comments
 (0)