我有一個(gè)如下的郵遞員圖像。如何在翻新2中執(zhí)行相同的操作。我已經(jīng)聲明了這樣的接口。@Multipart@POST("/api/Pharmarcy/UploadImage")Call<ResponseBody> uploadPrescriptionImage(
@Query("accessToken") String token,
@Query("pharmarcyRequestId") int pharmacyRequestedId,
@Part MultipartBody.Part image);
3 回答

繁華開滿天機(jī)
TA貢獻(xiàn)1816條經(jīng)驗(yàn) 獲得超4個(gè)贊
@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參數(shù)的方式。希望這個(gè)能對您有所幫助!
- 3 回答
- 0 關(guān)注
- 905 瀏覽
添加回答
舉報(bào)
0/150
提交
取消