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.
------WebKitFormBoundaryv7RHmVQhhWVAEycr
Content-Disposition: form-data; name="file"; filename="hey.jpg"
Content-Type: image/jpeg
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:
xmlhttp.open("post","http://localhost:8080/restService/api/submitinfo",true);
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.send(formData);
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?