title: Retrofit 2 image upload with TypedFile
body: <p>I was using Retrofit 1.9 to upload image like </p>
  
  <pre><code>TypedFile typedFile = new TypedFile("multipart/form-data", new File(ImagePath));
  </code></pre>
  
  <p>and it's work fine, Now I have to use Retrofit 2 due to response code requirement, so I have changed code accordingly this <a href="https://stackoverflow.com/a/34562971/3136595">answer</a> like</p>
  
  <pre><code>RequestBody filebody = RequestBody.create(MediaType.parse("image/*"), file);
  </code></pre>
  
  <p>I'm passing filebody along with other params to send request, so all other values post properly but imagefile didn't post properly. </p>
  
  <p>For both the case there is no change in API or Server side code, So I'm curious to know Do I have to change server side code or I'm missing something while writing android client code.</p>
  
  <p>have a look on fullcode</p>
  
  <pre><code>RequestBody requestFile = RequestBody.create(MediaType.parse("multipart/form-data"), file);
  MultipartBody.Part filebody = MultipartBody.Part.createFormData("product_img", file.getName(), requestFile);
  
  Call&lt;AddProduct&gt; call = service.sendEditProductRequest(name, filebody );
  </code></pre>
  
  <p>and the restinterface be like</p>
  
  <pre><code>@Multipart
  @POST(EDIT_PRODUCT)
  Call&lt;AddProduct&gt; sendEditProfileRequest (            
              @Part("name") RequestBody name,
              @Part MultipartBody.Part filebody);
  </code></pre>