@RequestPart(...) MultipartFile[] does not work (List<MultipartFile works) [SPR-11353] #15978
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
type: enhancement
A general enhancement
Milestone
Uh oh!
There was an error while loading. Please reload this page.
Benjamin M opened SPR-11353 and commented
I just discovered a minor issue, that was really nasty to discover.
@RequestMapping
(...)void upload1(
@RequestPart
("files[]") MultipartFile[] files) { ... }This throws some HttpMediaTypeNotSupportedException, because it takes all data that comes within files[] and tries to convert it via HttpMessageConverters.
When using List instead of MultipartFile[] it works as expected.
My Request looks like that:
Accept:*/*
Content-Length:4103
Content-Type:multipart/form-data; boundary=----WebKitFormBoundarynSUtw4ABfNjtPL29
------WebKitFormBoundarynSUtw4ABfNjtPL29
Content-Disposition: form-data; name="files[]"; filename="id_rsa.pub"
Content-Type: application/octet-stream
------WebKitFormBoundarynSUtw4ABfNjtPL29
Content-Disposition: form-data; name="files[]"; filename="test.csv"
Content-Type: text/csv
------WebKitFormBoundarynSUtw4ABfNjtPL29--
And afterwards I get an HTTP 415 which says:
Sent Content-Type "application/octet-stream" is not supported. Supported Content-Types are: "application/json;charset=UTF-8", "application/*+json;charset=UTF-8", "text/vcard", "application/octet-stream", "text/plain;charset=ISO-8859-1", "application/xml", "text/xml", "application/x-www-form-urlencoded", "application/*+xml", "multipart/form-data", "*/*"
Affects: 4.0 GA
Issue Links:
Referenced from: commits cc0a845
0 votes, 5 watchers
The text was updated successfully, but these errors were encountered: