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.