I am trying to add extra field to Multipart HTTP POST with addField method, but when I catch the packet with WireShark, I cannot see the effect of it. What could be the problem?
private void upload3(File file) {
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(url + "?recname=" + fileName);
MultipartEntity entity = new MultipartEntity();
String boundary = "---------------------------This is the boundary";
httpPost.addHeader("Content-Type", "multipart/form-data; boundary="
+ boundary);
try {
File f = new File( file_path);
FileBody body = new FileBody(f);
FormBodyPart fbp = new FormBodyPart( "file", body );
fbp.addField("Content-Type", "audio/mp4");
entity.addPart(fbp);
} catch (Exception e) {
e.printStackTrace();
}
httpPost.setEntity(entity);
}