Android Apache MultipartEntity: cannot add extra field like Content type -


i trying add field multipart http post addfield method, when catch packet wireshark, cannot see effect of it. problem?

private void upload3(file file) {         defaulthttpclient httpclient = new defaulthttpclient();         httppost httppost = new httppost(url + "?recname=" + filename);         multipartentity entity = new multipartentity();          string boundary = "---------------------------this 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);         } 

okay, found answer. problem was, when create new multipartentity generates random boundary, server waiting own boundary. had change multipartentity constructor this:

string boundary = "---------------------------yout own boundary"; multipartentity entity = new multipartentity(httpmultipartmode.browser_compatible, boundary, null); 

Comments

Popular posts from this blog

php - get table cell data from and place a copy in another table -

javascript - Mootools wait with Fx.Morph start -

php - Navigate throught databse rows -