简体   繁体   English

如何在android的服务器中上传多个选定的文件(即.doc、pdf、jpeg、png)

[英]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.

相关问题 如何将像视频音频PDF doc文本文件图像这样的文件从android上传到php服务器 - How to upload files like video audio PDF doc text file image from android to php server 使用php和android将文件(pdf,doc,jpg,png)上传到我的本地服务器 - Upload file(pdf,doc,jpg,png) to my local server using php with android 如何使用Android将.pdf .doc .txt文件上传到服务器(mysql数据库) - How to upload .pdf .doc .txt files to server(mysql database) using Android 将所选文件(PDF,doc)上传到服务器android - Uploading selected file(PDF, doc) to a server android 将图像从 Android 上传到仅接受 JPEG 和 PNG 的服务器 - Upload image from Android to Server that accepts only JPEG and PNG 我想从服务器下载文件,并在Android中使用各种文件扩展名(例如(pdf,doc,mp4,jpeg))查看文件 - I want to download the file from server and view the file in android with various file Extensions like (pdf,doc,mp4,jpeg)) 如何将 pdf 文件转换为 android 中的 doc 文件? - How to convert pdf files to doc file in android? Android:如何保存非JPEG和PNG格式的图像文件? [旋转后] - Android: How can I save image files that are not (JPEG & PNG)? [after rotate] 我如何在Titanium(Android)中以jpg或png格式在服务器上上传图像? - How I upload Image on server in jpg or png format in Titanium (Android)? 将doc,pdf,xls等文件从android应用程序上传到php服务器 - Upload doc, pdf,xls etc, from android application to php server
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM