I am uploading a file form sd card to server, for that i am using AndroidMultiPartEntity
but i have to change header content-type application/octet-stream to image/jpg defaultly it is taking application/octet-stream
My Code:
AndroidMultiPartEntity entity = new AndroidMultiPartEntity(new ProgressListener() {
@Override
public void transferred(long num) {
publishProgress((int) ((num / (float) totalSize) * 100));
}
});
File sourceFile = new File(filePath);
entity.addPart("mediaImg", new FileBody(sourceFile));
totalSize = entity.getContentLength();
httppost.setEntity(entity);
// Making server call
HttpResponse response = httpclient.execute(httppost);
HttpEntity r_entity = response.getEntity();
int statusCode = response.getStatusLine().getStatusCode();
I am using httpmime-4.3.6.jar for this
httppost.addHeader("Content-Type", "image/jpg");
i tried above one but it taking application/octet-stream
same problem https://github.com/loopj/android-async-http/issues/504