Flutter:
var request = new http.MultipartRequest("POST", url);
request.fields['name'] = 'John';
request.files.add(http.MultipartFile.fromPath(
'file1',
'/path/to/file1.jpg',
));
var response = await request.send();
On server side java servlet:
request.getParts();
throw exception:
java.lang.IllegalStateException: Unable to process parts as no multi-part configuration has been provided
at org.apache.catalina.connector.Request.parseParts(Request.java:2866)
at org.apache.catalina.connector.Request.getParts(Request.java:2834)
request.getContentType() is correct, returning "multipart/form-data; ...".
You have to add
awaitbeforehttp.MultipartFile.fromPathYou should be getting at servlet side after this change.