Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5a2af0f

Browse filesBrowse files
committed
feature #17955 [Validator] Add the option filenameMaxLength to the File constraint (alexandre-daubois)
This PR was merged into the 6.3 branch. Discussion ---------- [Validator] Add the option `filenameMaxLength` to the File constraint Fixes #17953 Commits ------- 1a1fb8f [Validator] Add the option `filenameMaxLength` to the File constraint
2 parents cdf5aa1 + 1a1fb8f commit 5a2af0f
Copy full SHA for 5a2af0f

File tree

1 file changed

+32
-0
lines changed
Filter options

1 file changed

+32
-0
lines changed

‎reference/constraints/File.rst

Copy file name to clipboardExpand all lines: reference/constraints/File.rst
+32Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.