[英]How to upload multiple selected files (i.e..doc,pdf,jpeg,png) in server at android
In android,how to select multiple files from file manager.在android中,如何从文件管理器中选择多个文件。 After will shown the details of the image(ie image size,image name and delete the files).
之后将显示图像的详细信息(即图像大小、图像名称和删除文件)。 Then how to upload that files to server.
然后如何将该文件上传到服务器。
You can do this by using Multi Part data upload and You can add multiple files in single array.您可以通过使用多部分数据上传来做到这一点,您可以在单个数组中添加多个文件。
If you are using Retrofit then please check this Android Upload Multiple Files In A Single Request Or which library you are using for api call?如果您正在使用 Retrofit,请检查此Android 在单个请求中上传多个文件或您使用哪个库进行 api 调用?
Yes you can see files[0]
, files[1]
means they are only uploading two files at a time.是的,您可以看到
files[0]
, files[1]
表示它们一次只上传两个文件。 here you can use loop to upload number of selected types.在这里您可以使用循环上传所选类型的数量。
ArrayList<String> listImages = new ArrayList();
Let's say you have to upload 10 files and all path is in arrylist.假设您必须上传 10 个文件,并且所有路径都在 arrylist 中。
for(int i = 0 ; i < listImages.size() ; i++ ){
params.put("files[" + i + "]", MultipartBody.create(mediaType, new File("First file path")));
}
Hope this help :)希望这有帮助:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.