1

I'm trying to upload an image using retrofit 2 to a PHP server, but I don't know how can I reach this/these parameters in PHP.

@Multipart
@POST("upload/TestImage")
Call<ResultObj> getImageOne(@Part("file\";file=\"image.png\"") RequestBody file);

@Multipart
@POST("upload/TestImage")
Call<ResultObj> uploadImage(@PartMap Map<String, RequestBody> params);
Termininja
  • 6,620
  • 12
  • 48
  • 49
zerstoer
  • 95
  • 10

1 Answers1

0

I solved it changing the retrofit version: compile 'com.squareup.retrofit2:retrofit:2.0.1' and using the multipart in this way:

@Multipart
@POST("/example/UpdInfo")
Call<Result> UpdateInfo(@Part MultipartBody.Part pic, @PartMap Map<String, RequestBody> params);
Pang
  • 9,564
  • 146
  • 81
  • 122
zerstoer
  • 95
  • 10
  • More details: http://stackoverflow.com/questions/36491096/retrofit-multipart-request-required-multipartfile-parameter-file-is-not-pre/36514662 – zerstoer May 03 '16 at 22:50