title: android send binary data in http
body: <p>I have the following code to send an image (bitmap binary data) using android http default client:</p>
  
  <pre><code>//gets raw binary data and convert it to a string
  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  photo.compress(Bitmap.CompressFormat.JPEG, 100, baos);
  byte[] imageBytes = baos.toByteArray();
  String imageData = new String(imageBytes);
  //http put body
  StringEntity se = new StringEntity(imageData);
  putRequest.setEntity(se);
  </code></pre>
  
  <p>I need to send its raw binary content in the put request body, but it seems that the content is not being properly sent.</p>
  
  <p>I can send an image binary using curl with the --data-binary (that's what I am trying to do in android).</p>
  
  <p>Is the process in converting the bitmap binary to string correct?</p>
  
  <p>Thanks!</p>