question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[multi-part requests] addMultipartFile() is not spec compliant (does not support multiple files for the same key)

See original GitHub issue

https://tools.ietf.org/html/rfc7578#section-4.3

To match widely deployed implementations, multiple files MUST be sent by supplying each file in a separate part but all with the same “name” parameter

https://github.com/amitshekhariitbhu/Fast-Android-Networking/blob/2d18407ca5aebe24e9d1b63b9abd673afde48b4e/android-networking/src/main/java/com/androidnetworking/common/ANRequest.java#L95

addMultiPartFile method stores the data in a hashmap, and adding multiple files by the same key name will result in the previous file reference being overwritten.

Please add a warning for this method (or in the docs), so that user’s know about this bug. Otherwise this can go unnoticed, which will lead to data loss for the clients.

related:

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
amitshekhariitbhucommented, Jul 24, 2018

Use this addMultipartFile(Map<String, File> multiPartFileMap)

1reaction
amitshekhariitbhucommented, Jul 24, 2018

@indraniltalukdar Yes, you can do like you have done above. Just pass the number and fileList as you have done above.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to send multipart/form-data request using Postman [closed]
@maxkoryukov Thank your for your comments. My API was not working at all while I was trying multipart file upload using Postman client....
Read more >
Uploading and copying objects using multipart upload
Multipart upload allows you to upload a single object as a set of parts. Each part is a contiguous portion of the object's...
Read more >
Form-based File Upload in HTML RFC 1867 - IETF Datatracker
The author of an HTML form who wants to request one or more files from a user would write (for example): <FORM ENCTYPE="multipart/form-data"...
Read more >
Handling File Uploads With Flask - miguelgrinberg.com
form and request.files dictionaries are really "multi-dicts", a specialized dictionary implementation that supports duplicate keys. This is ...
Read more >
Multipart (Form Data) Format - MuleSoft Documentation
Notice that the key determines the part's name if the name is not explicitly provided in the Content-Disposition header, and note that DataWeave...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found