0

How to post this body type form-data using retrofit. I tried with @Part but image is not getting save on server. Any idea where I'm making a mistake?

@Multipart
@POST("/saveData")
Call<MyResponse> saveImage(
        @Part("empsno") String empsno,
        @Part("lrSno") String lrsno,
        @Part("deliveryDate") String deliverydate,
        @Part("deliveryTime") String delvrytime,
        @Part("uploadFile") String upldfile,
        @Part("remarks") String remark,
        @Part("receivedBy") String recvdby,
        @Part("place") String place,
        @Part("ipAddress") String ip,
        @Part MultipartBody.Part images
);

By using form data I'm successfully able to post data:

Image

halfer
  • 19,824
  • 17
  • 99
  • 186
AMAN SINGH
  • 3,491
  • 6
  • 28
  • 44

1 Answers1

0

I made changes String to ResponseBody and now everything working fine

@Multipart
@POST("/saveData")
Call<MyResponse> saveImage(
    @Part("empsno") ResponseBody empsno,
    @Part("lrSno") ResponseBody lrsno,
    @Part("deliveryDate") ResponseBody deliverydate,
    @Part("deliveryTime") ResponseBody delvrytime,
    @Part("uploadFile") ResponseBody upldfile,
    @Part("remarks") ResponseBody remark,
    @Part("receivedBy") ResponseBody recvdby,
    @Part("place") ResponseBody place,
    @Part("ipAddress") ResponseBody ip,
    @Part MultipartBody.Part images
);
AMAN SINGH
  • 3,491
  • 6
  • 28
  • 44
  • Can you please help me with this detailed question? It would be really appreciate: https://stackoverflow.com/questions/62783444/why-does-multipart-pdf-is-not-able-to-upload-in-api-after-nougat-using-retrofit – Priyanka Singh Jul 10 '20 at 12:31
  • Yeah why not. Give some time, will reply you back – AMAN SINGH Jul 10 '20 at 13:07