- 表单
/**
* 工单录入
*/
@Multipart
@POST("your url")
Observable<JavaBean> addOrder(@PartMap HashMap<String, String> body);
- 多文件上传
for (String pathItem : imageLists) {
if (!TextUtils.isEmpty(pathItem)) {
File file = new File(pathItem);
RequestBody requestFile = RequestBody.create(MediaType.parse("image/jpg"), file);
MultipartBody.Part body = MultipartBody.Part.createFormData("pictures", file.getName(), requestFile);// pictures 是参数名
list.add(body);
}
}
同时上传多个参数 和图片
@Multipart
@POST(WorkSheetUriConstant.uploadIamge)
Observable<BaseResponse> upLoadImages(@QueryMap Map<String,String> params, @Part List<MultipartBody.Part> partList);