Using Retrofit 2.0.1, there is a call function in my API interface defined in Android App:
@Multipart
@POST(\"api.php\")
Call doAPI(
@Part(
Use RequestBody
for all your parameters. Please go through below code!!
File file = new File(imagePath);
RequestBody requestBody = RequestBody.create(MediaType.parse("multipart/form-data"), file);
MultipartBody.Part imageFileBody = MultipartBody.Part.createFormData("media", file.getName(), requestBody);
RequestBody id = RequestBody.create(MediaType.parse("text/plain"),addOfferRequest.getCar_id());
ApiCallback.MyCall myCall = apiRequest.editOfferImage(imageFileBody,id);
Use RequestBody
class of Retrofit
instead of String
@Multipart
@POST(ApiURL)
ApiCallback.MyCall editOfferImage(@Part MultipartBody.Part imageFile,@Part("id") RequestBody id);