title: How to remove header from data with java
body: <p>I'm getting back data (an image) from my database. It has a header which looks like this below and also a footer that says webkitboundry.</p>
  
  <pre><code>------WebKitFormBoundaryv7RHmVQhhWVAEycr
  Content-Disposition: form-data; name="file"; filename="hey.jpg"
  Content-Type: image/jpeg
  </code></pre>
  
  <p>image IO in java does not recognize this as a valid image because of the header and footer. I am sending this to my database like so:</p>
  
  <pre><code>xmlhttp.open("post","http://localhost:8080/restService/api/submitinfo",true);
  xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  xmlhttp.send(formData);
  </code></pre>
  
  <p>is there any way I can send this file without the header or how can I go about removing it? I know I might be able to strip it with some for loops but I'm curious that there might be another way. What do you professionals do with this?</p>