[Form] tweaked the error message when a form with a file upload does not have the enctype attribute correctly configured
This commit is contained in:
parent
0a7ce63d8f
commit
88184394b5
@ -64,11 +64,11 @@ class FileToArrayTransformer implements DataTransformerInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!array_key_exists('file', $array)) {
|
if (!array_key_exists('file', $array)) {
|
||||||
throw new TransformationFailedException('The key "file" is missing');
|
throw new TransformationFailedException('The key "file" is missing.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($array['file']) && !$array['file'] instanceof File) {
|
if (!empty($array['file']) && !$array['file'] instanceof File) {
|
||||||
throw new TransformationFailedException('The key "file" should be empty or instance of File');
|
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"?).');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $array['file'];
|
return $array['file'];
|
||||||
|
Reference in New Issue
Block a user