8000 [Form] tweaked the error message when a form with a file upload does … · 77web/symfony@8818439 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8818439

Browse files
committed
[Form] tweaked the error message when a form with a file upload does not have the enctype attribute correctly configured
1 parent 0a7ce63 commit 8818439

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Symfony/Component/Form/Extension/Core/DataTransformer/FileToArrayTransformer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@ public function reverseTransform($array)
6464
}
6565

6666
if (!array_key_exists('file', $array)) {
67-
throw new TransformationFailedException('The key "file" is missing');
67+
throw new TransformationFailedException('The key "file" is missing.');
6868
}
6969

7070
if (!empty($array['file']) && !$array['file'] instanceof File) {
71-
throw new TransformationFailedException('The key "file" should be empty or instance of File');
71+
throw new TransformationFailedException('The key "file" should be empty or instance of File (Have you set the "enctype" attribute of the form tag to "multipart/form-data"?).');
7272
}
7373

7474
return $array['file'];

0 commit comments

Comments
 (0)
0