Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commitaafade6

Browse files
committed
minor#20893 [Validator] Highlightextensions instead ofmimeTypes forFile constraint (benito103e)
This PR was submitted for the 7.2 branch but it was merged into the 6.4 branch instead.Discussion----------[Validator] Highlight `extensions` instead of `mimeTypes` for `File` constraintYou should always use the extensions option instead of mimeTypes except if you explicitly don't want to check that the extension of the file is consistent with its content (this can be a security issue).By default, the extensions option also checks the media type of the file.<!--If your pull request fixes a BUG, use the oldest maintained branch that containsthe bug (seehttps://symfony.com/releases for the list of maintained branches).If your pull request documents a NEW FEATURE, use the same Symfony branch wherethe feature was introduced (and `7.x` for features of unreleased versions).-->Commits-------3474a09 Highligh 'extensions' instead of 'mimeTypes' for File constraint
2 parents042f70d +3474a09 commitaafade6

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

‎controller/upload_file.rst

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,8 @@ so Symfony doesn't try to get/set its value from the related entity::
7777
'constraints' => [
7878
new File([
7979
'maxSize' => '1024k',
80-
'mimeTypes' => [
81-
'application/pdf',
82-
'application/x-pdf',
83-
],
84-
'mimeTypesMessage' => 'Please upload a valid PDF document',
80+
'extensions' => ['pdf'],
81+
'extensionsMessage' => 'Please upload a valid PDF document',
8582
])
8683
],
8784
])

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp