I\'m using apache HttpClient
to post several files to server. Here\'s the code:
public static HttpResponse stringResponsePo
Got a solution for my second question, the trick is to write MultipartEntity
to a ByteArrayOutputStream
, create a ByteArrayEntity
from ByteArrayOutputStream
and enable chunking on that. Here's the the code:
ByteArrayOutputStream bArrOS = new ByteArrayOutputStream();
// reqEntity is the MultipartEntity instance
reqEntity.writeTo(bArrOS);
bArrOS.flush();
ByteArrayEntity bArrEntity = new ByteArrayEntity(bArrOS.toByteArray());
bArrOS.close();
bArrEntity.setChunked(true);
bArrEntity.setContentEncoding(reqEntity.getContentEncoding());
bArrEntity.setContentType(reqEntity.getContentType());
// Set ByteArrayEntity to HttpPost
post.setEntity(bArrEntity);