0

I am trying to upload a pdf and image to a server. I am able to upload the image successfully. I am using the same code for pdf as it says to add only file no type :

  MultipartEntityBuilder builder = MultipartEntityBuilder.create();
            builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);
 builder.addTextBody("USER_ID", Uid);
            builder.addTextBody("SERIAL_NO", Srno);
            builder.addTextBody("CUST_NO", CUST_NO);
            builder.addTextBody("SESSION_ID", Sid);
 File file = new File(filepaths.get(0));
                Log.d("file",file.getName());
//                builder.addBinaryBody("file[]", file,
//                        ContentType.create("*/*"), file.getName());
                builder.addPart("file[]",new FileBody(file));

for image i am getting sucess in response, in loading pdf i am getting some issue. how do i add pdf to the server using this code?

Parth Anjaria
  • 3,961
  • 3
  • 30
  • 62

0 Answers0