title: POST Multipart Form Data using Retrofit 2.0 including image
body: <p>I am trying to do a HTTP POST to server using <strong>Retrofit 2.0</strong></p>
  
  <pre><code>MediaType MEDIA_TYPE_TEXT = MediaType.parse("text/plain");
  MediaType MEDIA_TYPE_IMAGE = MediaType.parse("image/*");
  
  ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
      imageBitmap.compress(Bitmap.CompressFormat.JPEG,90,byteArrayOutputStream);
  profilePictureByte = byteArrayOutputStream.toByteArray();
  
  Call&lt;APIResults&gt; call = ServiceAPI.updateProfile(
          RequestBody.create(MEDIA_TYPE_TEXT, emailString),
          RequestBody.create(MEDIA_TYPE_IMAGE, profilePictureByte));
  
  call.enqueue();
  </code></pre>
  
  <p>The server returns an error saying the file is not valid. </p>
  
  <p>This is weird because I have tried to upload the same file with the same format on iOS(using other library), but it uploads successfully.</p>
  
  <p>I am wondering what is the proper way to upload an image using <strong>Retrofit 2.0</strong>?  </p>
  
  <p>Should I save it to disk first before uploading?</p>
  
  <p>P.S.: I have used retrofit for other Multipart request that does not include image and they completed successfully. The problem is when I am trying to include a byte to the body.</p>