Here is the problem I am trying to send an image to a remote server using the class MultipartPostData.
I build my PostData with the following code :
PostData body = new MultipartPostData(MultipartPostData.DEFAULT_CHARSET, false);
body.append("deviceID", ""+DeviceInfo.getDeviceId());
body.append("synchro", "true");
body.append("shoot_lat", ""+latitude);
body.append("shoot_long", ""+longitude);
body.append("shoot_place", ""+city);
body.append("shoot_time", String.valueOf(time));
body.append("ref_data", "filename=\"photo.jpg\"");
//image is a byte[]
body.setData(image);
I think something is wrong in the way of setting the image because the server can not get this body (if I print the data received and analysed by the server in the body of the request, I get a blank string).
Can anybody help to build a working request to send an image ?
Thanks a lot.
Ok, I finally found the answer by myself.
The Hashtable contains all the parameters of the form. And the fileBytes contains the data to send.