I know I can upload single file from AsyncHttpClient
http://loopj.com/android-async-http/
File myFile = new File("/path/to/file.png");
RequestParams params = new RequestParams();
try {
params.put("profile_picture", myFile);
} catch(FileNotFoundException e) {}
But I have to upload multiple files to the server with multipart post. How can I do that?
You can pass a file array as value for the files key. In order to do that, follow the code below:
Aditionally, if you want a dynamic array, you can use an ArrayList and convert to File[] type with the method .toArray()
Hope this help. =D
Create the SimpleMultipartEntity object and call the addPart for each file that you want to upload.
File[] files = lst.toArray(new File[lst.size()]);
You should use this code:
You should pass all your files as parameter on params. For example: