I am trygin to upload a image with a POST request with the next requirements:
Parameter name: imageFile
Parameter type: File
File to be uploaded. It must be included in the body of the request as multipart part with value=image and type=image/*.
This is the request definition:
@Multipart
@POST("sample/uploadImage")
Call<ImageResponse> UploadImage(@Part MultipartBody.Part file);
This is the code:
RequestBody fbodyRequest = RequestBody.create(MediaType.parse("image/*"), destination);
[...]
RetrofitInterface apiService =
retrofit.create(RetrofitInterface.class);
Call<ImageResponse> call = apiService.UploadImage(fbodyRequest);
call.enqueue(new Callback<ImageResponse>() {...
Thanks in advance.