I have a program that accepts HTTP post of files and write all the POST result into a file, I want to write a script to delete the HTTP headers, only leave the binary file data, how to do it?

The file content is below (the data between `Content-Type: application/octet-stream` and `------------KM7cH2GI3cH2Ef1Ij5gL6GI3Ij5GI3` is what I want:

```
POST /?user_name=vvvvvvvv&size=837&file_name=logo.gif& HTTP/1.1^M
Accept: text/*^M
Content-Type: multipart/form-data; boundary=----------KM7cH2GI3cH2Ef1Ij5gL6GI3Ij5GI3^M
User-Agent: Shockwave Flash^M
Host: 192.168.0.198:9998^M
Content-Length: 1251^M
Connection: Keep-Alive^M
Cache-Control: no-cache^M
Cookie: cb_fullname=ddddddd; cb_user_name=cdc^M
^M
------------KM7cH2GI3cH2Ef1Ij5gL6GI3Ij5GI3^M
Content-Disposition: form-data; name="Filename"^M
^M
logo.gif^M
------------KM7cH2GI3cH2Ef1Ij5gL6GI3Ij5GI3^M
Content-Disposition: form-data; name="Filedata"; filename="logo.gif"^M
Content-Type: application/octet-stream^M
^M
GIF89an^@I^^M
------------KM7cH2GI3cH2Ef1Ij5gL6GI3Ij5GI3^M
Content-Disposition: form-data; name="Upload"^M
^M
Submit Query^M
------------KM7cH2GI3cH2Ef1Ij5gL6GI3Ij5GI3-

```
['https://Stackoverflow.com/questions/4236020', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/197036/']
If you use Python, [`email.parser.Parser`](http://docs.python.org/library/email.parser.html#parser-class-api) will allow you to parse a multipart MIME document.
Look at the [Mime::Tools suite](http://search.cpan.org/perldoc?MIME%3a%3aTools) for Perl. It has a rich set of classes; I’m sure you could put something together in just a few lines.