I\'m trying to do something I thought would be relatively simple: Upload an image to a server with the Android SDK. I\'m found a lot of example code:
http://groups.g
I highly recommend Loopj.
I have successfully used it to upload multiple files at once, including different mime types. Simply do this:
File myVideo = new File("/path/to/myvideo.mp4");
File myPic = new File("/path/to/mypic.jpg");
RequestParams params = new RequestParams();
try {
params.put("profile_picture", myPic);
params.put("my_video", myVideo);
} catch(FileNotFoundException e) {}
For large or many files you might have to increase the timeout amount else the default timeout is used which might be too short:
client.setTimeout(500000) //make this the appropriate timeout in milliseconds
Please see this links for a full description of loopj and how to use it, by far the easiest async http library I have come across:
http://loopj.com/android-async-http/ http://loopj.com/android-async-http/doc/com/loopj/android/http/AsyncHttpClient.html