title: Uploading image to server in Multipart along with JSON data in Android
body: <p>I am trying to upload an image to a server along with some JSON data that is collected from a form.</p>
  
  <p>The server has authentication.</p>
  
  <pre><code>METHOD: post
  
  HEADERS:
  
  Authorization   Basic d2Vic2VydmljZTpyM05hdTE3Rw==
  
  Content-Type    multipart/form-data;boundary=xxxxxxxx
  
  BODY:
  
  --xxxxxxxx
  
  Content-Disposition: form-data; name="jsonFile"
  Content-Type: application/json
  
  {"model":"Premium","deviceLongitude":4.79337638,"pseudo":"nickname","deviceLatitude":45.7671507,"year":"2005","email":"email@mail.com","deviceLocale":"fr_FR","title":"my picture"}
  
  --xxxxxxxx
  
  Content-Disposition: form-data; name="imgName"
  Content-Type: image/jpeg
  
  //Image data array
  
  /9j/4AAQSkZJRgABAQAAAQABAAD/4QBYRXhpZgAATU0AKgAAAAgAAgESAAMAAAAB
  AAEAAIdpAAQAAAABAAAAJgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAB4KAD
  AAQAAAABAAACgAAAAAD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEB
  AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wBDAQEBAQEBAQEB
  AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEB
  AQEBAQEBAQH/wAARCAKAAeADAREAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAA
  AAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF
  --xxxxxxxx
  </code></pre>