@Multipart @POST("postFied") Call<Void> postFied(@PartMap Map<String,String> map, @Part MultipartBody.Part file); File file=new File("/sdcard/shumei.txt"); RequestBody body=RequestBody.create(MediaType.parse("application/octet-stream"),file); // RequestBody body=RequestBody.create(MediaType.parse("multipart/form-data"),file); MultipartBody.Part part =MultipartBody.Part.createFormData("file",file.getName(),body); Map<String, String> map = new HashMap<>(); map.put("name","123456"); Call<Void> liing = api.postFied(map,part);
retrofit 上传文件 跟参数
猜你喜欢
转载自www.cnblogs.com/libing029/p/12345392.html
今日推荐
周排行