My code:
protected String doInBackground(HttpResponse... arg0)
{
String result = "";
File file = new File(selectImages);
try {
HttpClient client = new DefaultHttpClient();
String postURL = "https://192.168.1.11/api/review/add_image.php?";
post = new HttpPost(postURL);
FileBody bin = new FileBody(file);
totalSize = bin.getContentLength();
MultiPartEntity reqEntity = new MultiPartEntity(HttpMultipartMode.BROWSER_COMPATIBLE, new ProgressListener()
{
public void transferred(long num)
{
publishProgress((int) ((num / (float) totalSize) * 100));
}
});
reqEntity.addPart("userfile", bin);
post.setEntity(reqEntity);
HttpResponse response = client.execute(post);
HttpEntity resEntity = response.getEntity();
if (resEntity != null) {
result = EntityUtils.toString(resEntity);
}
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
protected String doInBackground(Http