I am pretty eco-friendly to HttpClient and I am finding the possible lack of (as well as coldly incorrect) documentation very frustrating. I am attempting to implement the next publish (the following) with Apache Http Client, but have no clue how you can really get it done. I am likely to bury myself in documentation for the following week, but possibly more knowledgeable HttpClient programmers might get me a solution sooner.

Publish:

Content-Type: multipart/form-data; boundary=---------------------------1294919323195
Content-Length: 502
-----------------------------1294919323195
Content-Disposition: form-data; name="number"

5555555555
-----------------------------1294919323195
Content-Disposition: form-data; name="clip"

rickroll
-----------------------------1294919323195
Content-Disposition: form-data; name="upload_file"; filename=""
Content-Type: application/octet-stream


-----------------------------1294919323195
Content-Disposition: form-data; name="tos"

agree
-----------------------------1294919323195--

Use MultipartEntity to do request you would like. During my project I actually do that by doing this:

MultipartEntity entity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
entity.addPart("number", new StringBody("5555555555"));
entity.addPart("clip", new StringBody("rickroll"));
File fileToUpload = new File(filePath);
FileBody fileBody = new FileBody(fileToUpload, "application/octet-stream");
entity.addPart("upload_file", fileBody);
entity.addPart("tos", new StringBody("agree"));

HttpPost httpPost = new HttpPost("http://some-web-site");
httpPost.setEntity(entity);
HttpResponse response = httpClient.execute(httpPost);
HttpEntity result = response.getEntity();

Hope this helps.

This is a snippet that shows using publish method with params in httpclient 4.