I'm trying to upload an image using the following code:
HttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(
"http://konsole-data.de/uploadtest/upload.php");
MultipartEntity multiPart = new MultipartEntity();
multiPart.addPart("picture", new FileBody(new File(path)));
httpPost.setEntity(multiPart);
try {
HttpResponse res = httpClient.execute(httpPost);
Toast.makeText(getApplicationContext(),res.toString(),
Toast.LENGTH_LONG).show();
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
path is a String which identifies the image like /mnt/sdcard/DCIM/12712.jpg The connection works BUT no image is uploaded to the server, you can see a debug file here: http://konsole-data.de/uploadtest/data/20121214-144802-.dbg
What am doing wrong?