我有一个如下的邮递员图像。如何在翻新2中执行相同的操作。我已经声明了这样的接口。@Multipart@POST("/api/Pharmarcy/UploadImage")Call<ResponseBody> uploadPrescriptionImage(
@Query("accessToken") String token,
@Query("pharmarcyRequestId") int pharmacyRequestedId,
@Part MultipartBody.Part image);
3 回答
繁华开满天机
TA贡献1816条经验 获得超4个赞
@Multipart@POST("user/updateprofile")Observable<ResponseBody> updateProfile(@Part("user_id") RequestBody id, @Part("full_name") RequestBody fullName, @Part MultipartBody.Part image, @Part("other") RequestBody other);//pass it like thisFile file = new File("/storage/emulated/0/Download/Corrections 6.jpg");RequestBody requestFile = RequestBody.create(MediaType.parse("multipart/form-data"), file);// MultipartBody.Part is used to send also the actual file nameMultipartBody.Part body = MultipartBody.Part.createFormData("image", file.getName(), requestFile);// add another part within the multipart requestRequestBody fullName = RequestBody.create(MediaType.parse("multipart/form-data"), "Your Name");service.updateProfile(id, fullName, body, other);
看看我传递multipart和string参数的方式。希望这个能对您有所帮助!
- 3 回答
- 0 关注
- 888 浏览
添加回答
举报
0/150
提交
取消