HTTP/1.1 400 Bad Request on Android when trying to upload image via Http Put

时间:2015-05-04 19:40:49

标签: android http-put

I a a new comer to Android development. I am trying to upload an image through HTTP PUT from an android device. When i run the following code, my response shows HTTP/1.1 400 Bad Request error.

Any help to solve this issue will be appreciated. Here is the code snippet i have been using.

File file = new File(imageAdd);
HttpPut job = new HttpPut("http://api.abcd.com/");
FileEntity entity = new FileEntity(file, "image/jpeg");
entity.setChunked(true);
job.setEntity(entity);
HttpResponse response = httpClient.execute(host,job,credContext);

0 个答案:

没有答案