I'm trying to read image data posted to a servlet using request.getInputStream(); In my servlet, I read the incoming inputstream and write the content to a file on the filesystem. When I open the file to view the image, it cannot show the image as the file seems to be corrupted. When I open the file in a text editor, it contains the binary content, but at the beginning of the file are what looks to be header information:
I thought getInputStream returns the body of the request, not any header information. Is there any way to remove this information in the servlet? I deleted this header information from the file, and was able to view the file properly.
The data is posted to my servlet via a 3rd party ActiveX control in my form, and I'm not using any file upload mechanisms as the image isn't uploaded via a file input type. The image is scanned into the ActiveX control and POSTed to my servlet.