Попробуйте это
@Multipart
@POST(Global.updateProfilePicture)
Call<YOUR_RESPONSE_MODEL> updatePicture(@Header("Authorization") String authorization, @PartMap Map<String, RequestBody> params);
И вызов API должен быть таким:
public void updatePic(String senderID, String receiverID, String type, File photo) {
mProgressDialog.show();
final Map<String, RequestBody> map = new HashMap<>();
try {
RequestBody fileBody = RequestBody.create(MediaType.parse("multipart/form-data"), photo);
map.put("image\"; filename=\"" + photo.getName() + "\"", fileBody);
} catch (Exception e) {
e.printStackTrace();
}
map.put("sender_id", RequestBody.create(MediaType.parse("multipart/form-data"), senderID));
map.put("receiver_id", RequestBody.create(MediaType.parse("multipart/form-data"), receiverID));
map.put("type", RequestBody.create(MediaType.parse("multipart/form-data"), type));
Call<YOUR_RESPONSE_MODEL> call = mApiInterface.updatePicture(ACCESS_TOKEN, map);
call.enqueue(new Callback<YOUR_RESPONSE_MODEL>() {
@Override
public void onResponse(@NonNull Call<YOUR_RESPONSE_MODEL> call, @NonNull Response<YOUR_RESPONSE_MODEL> response) {
if (mContext != null) {
mProgressDialog.dismiss();
// Dismiss Dialog
}
}
@Override
public void onFailure(@NonNull Call<YOUR_RESPONSE_MODEL> call, @NonNull Throwable t) {
if (mContext != null) {
mProgressDialog.dismiss();
}
}
});
}