Skip to content
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

multiple file upload does not work #1469

Closed
psyopussy opened this issue Jan 13, 2016 · 4 comments
Closed

multiple file upload does not work #1469

psyopussy opened this issue Jan 13, 2016 · 4 comments

Comments

@psyopussy
Copy link

if i follow the docs: http://square.github.io/retrofit/2.x/retrofit/retrofit2/http/PartMap.html

it does not work,
i get a lot of gibberish on the server side and also it seems like it is only trying to upload the last image of the list of images.

if i try it like this only the last image in the map is uploaded:


HashMap<String, RequestBody> partMap = new HashMap<String, RequestBody>();
partMap.put("file"; filename="" + file.getName(), requestBody);
partMap.put("file"; filename="" + file2.getName(), requestBody);
Call call = service.upload(partMap);


@multipart
@post("/upload")
Call upload(
@PartMap() Map<String, RequestBody> partMap
);


@raniejade
Copy link

This might help http://stackoverflow.com/a/33477879/1425525. Not an issue, ask questions on stackoverflow with the retrofit tag.

@psyopussy
Copy link
Author

using MultipartBuilder gives an error:
java.lang.IllegalArgumentException: @Body parameters cannot be used with form or multi-part encoding. (parameter #1)

got it working without it though :)
http://stackoverflow.com/questions/34778224/android-retrofit-2-multiple-file-upload-howto

thx for pointing me in the right direction

@rohnstock
Copy link

@psyopussy
The solution on your link works fine!
Thank you.

@JakeWharton
Copy link
Collaborator

Since it's working and #1140 is tracking normal filename-based part uploading I'm closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants