-
Notifications
You must be signed in to change notification settings - Fork 381
Multipart form-data request is not working properly. Am i missing something here? #425
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @1207roy, could you share the exact lines, which you’re using. Note: please use your code statements with "insert code" Example: request.fields['documentType'] = 'random types';
request.fields['notes'] = 'xyz';
request.fields['date'] = '2020-05-30';
request.fields['documentName'] = 'abc' |
same with me here. is this solved? |
Any Solution For this |
To me, I get some fields empty, I don't have a clue why, if I set the values, some of them are null: request.fields['firstName'] = map['nombre']; // With data
request.fields['LastName'] = map['apellido']; // map has the value, request.fields is null
request.fields['password'] = map['password']; //With data
request.fields['phone'] = map['telefono']; // map has the value, request.fields is null |
for me it only sends the first image |
This is very weird, there are a lot of people facing this issue (including me), and no one from the flutter community is helping this out! |
yess, there is a problem in the multipart request. |
Same thing here, 4 days trying to figure out what I was doing wrong (it wasn't me). I finally had to use Dio, at least while the HTTP team resolves this bug. |
My server receives empty array of inputs (request.fields) ! This is really weird. |
I'm having trouble with the "await request.send()" part. Apparently the request doesn't even leave the application. |
I am sending one image file (XFile) from memory along with others fields, but it returns a status code of 400. On Postman it's working properly, and I followed the documentation except that the MultipartFile came from a stream of bytes as opposed to a path. |
Would it be possible for someone to include a minimum reproduction? |
maybe it's related to this one |
I am trying to send a multipart form-data request in flutter using http package
Code is as below:
//request
var request = http.MultipartRequest('POST', Uri.parse(uploadDocumentsUrl));
//add header fields from requestHeader map
request.headers.addAll(requestHeader);
//add fields
request.fields['documentType'] = 'random types';
request.fields['notes'] = 'xyz;
request.fields['date'] = '2020-05-30';
request.fields['documentName'] = 'abc'
//add image files, File imagefile1, File imagefile2
request.files.add(http.MultipartFile.fromPath('file1', imagefile1.path));
request.files.add(http.MultipartFile.fromPath('file2', imagefile2.path));
print('request files: ${request.files}); //it prints an empty list
//final send the request
var response = await request.send();
//check result status
print('response code: ${response.statusCode}');
//get data
String jsonString;
await response.stream.transform(utf8.decoder).listen((value) {
jsonString = value;
});
Postman screenshot:
Issue:
Is there any problem with my code?
The text was updated successfully, but these errors were encountered: