0

I want to send *.log file to server. Before, I used apache lib to send *.log file,my code like:

FileBody cont = new FileBody(file);
MultipartEntity reqEntity = new MultipartEntity();
reqEntity.addPart("log", cont);
reqEntity.addPart("log_name", logname);
httppost.setEntity(reqEntity);

When I used HttpURLConnection, the code like:

OutputStream outputStream = client.getOutputStream();
byte[] logFile = read(file);
outputStream.write(logFile);
...

I knew that, with this modification, server side also must change something to get log file. But, I don't want any server modification. So, How can I replace MultipartEntity and FileBody in HttpURLConnection without server side modification? Thank you.

User_1191
  • 981
  • 2
  • 8
  • 24
TBL
  • 1
  • 1
  • Just search this site for some post examples with HttpUrlConnection. There are hundreds. – greenapps Dec 21 '15 at 10:34
  • I searched, but in my case, server side had been implemented for get *.log file with old method (use apache lib). so, I want to know how to change client method (from use apache lib to HttpURLConnection) without server side modification. – TBL Dec 21 '15 at 10:48
  • You already told that. We know. Now start searching this site for examples. Use the word boundary. – greenapps Dec 21 '15 at 11:02
  • @greenapps: I found out the solution, thank you so much... – TBL Dec 22 '15 at 06:25

0 Answers0