Image not found exception while posting to twitpic using httpclient
I am using commons-httpclient-3.1 jar file to Post multipart file to twitpic , iam getting Image not found exception here is my code HttpClient client = new HttpClient(); client.getHttpConnectionManager().getParams().setConnectionTimeout(100000);
PostMethod method = new PostMethod("http://twitpic.com/api/uploadAndPost");
FilePart photo = new FilePart("photo", new ByteArrayPartSource("photo", b));
photo.setContentType("image/jpeg");
photo.setCharSet(null);
Part[] parts = { new StringPart("service", "Android mobile"),
new StringPart("username", "xxxxxx"),
new StringPart("password", "xxxxxx"),
new StringPart("message", "Test message"),
photo };
try {
method.setRequestEntity(new MultipartRequestEntity(parts, method.getP开发者_如何学运维arams()));
client.executeMethod(method);
responseString = method.getResponseBodyAsString();
method.releaseConnection();
} catch (HttpException e) {
Log.v("e",e.toString());
e.printStackTrace();
} catch (IOException e) {
Log.v("e2",e.toString());
e.printStackTrace();
}
finally {
method.releaseConnection();
}
Log.v( "Response status: " , responseString);
Any suggestion ,why i am getting this error and why i cannot post images? thanks ganesh
精彩评论