您好,欢迎来到爱go旅游网。
搜索
您的当前位置:首页Retrofit2 @PartMap上传多文件

Retrofit2 @PartMap上传多文件

来源:爱go旅游网

 APIService :

 代码里:

             Map<String,RequestBody> map=new HashMap<>();
                map.put("idCard",RequestBody.create(MediaType.parse("multipart/form-data"),sfz));
                map.put("name",RequestBody.create(MediaType.parse("multipart/form-data"),name));
                map.put("phone",RequestBody.create(MediaType.parse("multipart/form-data"),phone));
                map.put("pictureNumber",RequestBody.create(MediaType.parse("multipart/form-data"),String.valueOf(imgList.size)));
            //多个图片文件
                for (int i = 0; i <4 ; i++) {
                        File file=new File(imgList.get(i));
                        map.put("image"+i+"\";filename=\""+"image"+i+".jpg"
                                ,RequestBody.create(MediaType.parse("multipart/form-data"),file));
                }

 

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- igat.cn 版权所有 赣ICP备2024042791号-1

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务