Skip to content

Commit e5f07a0

Browse files
authored
Note requirement to explicitly enabling multipart as an input format (#1943)
V3.3 has become more strict about input format checking (intentionally or otherwise) and users need to be more rigorous in allowing multipart when using it for file uploads. Prior to v3.3, I suspect people should have been defining this, but it wasn't being checked, so many won't have done. Not sure my "note" format is in the preferred document style - possibly we don't want to mention the version for example? Feel free to edit or request changes.
1 parent 24944f8 commit e5f07a0

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

core/file-upload.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ use Vich\UploaderBundle\Mapping\Annotation as Vich;
7979
new Get(),
8080
new GetCollection(),
8181
new Post(
82+
inputFormats: ['multipart' => ['multipart/form-data']],
8283
controller: CreateMediaObjectAction::class,
8384
deserialize: false,
8485
validationContext: ['groups' => ['Default', 'media_object_create']],
@@ -124,6 +125,7 @@ class MediaObject
124125
}
125126
}
126127
```
128+
Note: From V3.3 onwards, `'multipart/form-data'` must either be including in the global API-Platform config, either in `formats` or `defaults->inputFormats`, or defined as an `inputFormats` parameter on an operation by operation basis.
127129

128130
### Creating the Controller
129131

0 commit comments

Comments
 (0)