http_server
http_server copied to clipboard
Multiple values in same field
I'm trying to send multiple files to the server but the server only gets one.
// Client
FormData formData = FormData();
for (var i = 0; i < files.length; i++) {
formData.appendBlob('files', files[i]);
formData.append('paths', filePaths[i]);
}
print(formData.getAll('paths')); // Has multiple values
HttpRequest.request('/files', method: "POST", sendData: formData).then((res) {
...
}).catchError((e) {
...
});
// Server
HttpBodyHandler.processRequest(req).then((post) {
print(post.body); // Each field only has 1 value
});