Source:
public void postImg(final Context context, final ProductImage image) { final LoadToast lt = new LoadToast(context); lt.setText(context.getString(R.string.toastSending)); lt.setBackgroundColor(context.getResources().getColor(R.color.blue)); lt.setTextColor(context.getResources().getColor(R.color.white)); lt.show(); String lang = Locale.getDefault().getLanguage(); HashMap<String, RequestBody> imgMap = new HashMap<>(); imgMap.put("code", image.getCode()); imgMap.put("imagefield", image.getField()); imgMap.put("imgupload_front\"; filename=\"front_"+ lang +".png\"", image.getImguploadFront()); imgMap.put("imgupload_ingredients\"; filename=\"ingredients_" + lang + ".png\"", image.getImguploadIngredients()); imgMap.put("imgupload_nutrition\"; filename=\"nutrition_" + lang + ".png\"", image.getImguploadNutrition()); imgMap.put("imgupload_other\"; filename=\"other_" + lang + ".png\"", image.getImguploadOther()); apiService.saveImage(imgMap) .enqueue(new Callback<JsonNode>() { @Override public void onResponse(Call<JsonNode> call, Response<JsonNode> response) { if(!response.isSuccess()) { Toast.makeText(context, context.getString(R.string.errorWeb), Toast.LENGTH_LONG).show(); lt.error(); return; } JsonNode body = response.body(); if (body == null || !body.isObject()) { lt.error(); } else if (body.get("status").asText().contains("status not ok")) { Toast.makeText(context, body.get("error").asText(), Toast.LENGTH_LONG).show(); lt.error(); } else { lt.success(); } } @Override public void onFailure(Call<JsonNode> call, Throwable t) { Toast.makeText(context, context.getString(R.string.errorWeb), Toast.LENGTH_LONG).show(); lt.error(); } }); }

Target:
public void postImg(final Context context, final ProductImage image) { final LoadToast lt = new LoadToast(context); lt.setText(context.getString(R.string.toastSending)); lt.setBackgroundColor(context.getResources().getColor(R.color.blue)); lt.setTextColor(context.getResources().getColor(R.color.white)); lt.show(); String lang = Locale.getDefault().getLanguage(); Map<String, RequestBody> imgMap = new HashMap<>(); imgMap.put("code", image.getCode()); imgMap.put("imagefield", image.getField()); imgMap.put("imgupload_front\"; filename=\"front_"+ lang +".png\"", image.getImguploadFront()); imgMap.put("imgupload_ingredients\"; filename=\"ingredients_" + lang + ".png\"", image.getImguploadIngredients()); imgMap.put("imgupload_nutrition\"; filename=\"nutrition_" + lang + ".png\"", image.getImguploadNutrition()); imgMap.put("imgupload_other\"; filename=\"other_" + lang + ".png\"", image.getImguploadOther()); apiService.saveImage(imgMap) .enqueue(new Callback<JsonNode>() { @Override public void onResponse(Call<JsonNode> call, Response<JsonNode> response) { if(!response.isSuccess()) { Toast.makeText(context, context.getString(R.string.errorWeb), Toast.LENGTH_LONG).show(); lt.error(); return; } JsonNode body = response.body(); if (body == null || !body.isObject()) { lt.error(); } else if (body.get("status").asText().contains("status not ok")) { Toast.makeText(context, body.get("error").asText(), Toast.LENGTH_LONG).show(); lt.error(); } else { lt.success(); } } @Override public void onFailure(Call<JsonNode> call, Throwable t) { Toast.makeText(context, context.getString(R.string.errorWeb), Toast.LENGTH_LONG).show(); lt.error(); } }); }