Hi Greg.. well there is a future project in which the answer to your question will be useful to me, so I looked it more thoroughly.. I made a TCP/IP sniffer to see the request of FireFox when it uploads data. I could read the protocols as well, but this way is much faster for me.. here is how FireFox sends requests with uploaded data:
POST / HTTP/1.1
Host: localhost:1234567
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.7) Gecko/20060909 Firefox/1.5.0.7
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://localhost/test/test.php
Cookie: dbx-postmeta=grabit=0-,1-,2-,3-,4-,5-,6-&advancedstuff=0+,1-,2+,3-,4+,5-; PHPSESSID=1cc1855d69c1c1ec5a8f11166e4d0968
Content-Type: multipart/form-data; boundary=---------------------------5272992921246
Content-Length: [..content length..]
-----------------------------5272992921246
Content-Disposition: form-data; name="MAX_FILE_SIZE"
2097152
-----------------------------5272992921246
Content-Disposition: form-data; name="txtMessage"
message
-----------------------------5272992921246
Content-Disposition: form-data; name="file"; filename="image.jpg"
Content-Type: image/jpeg
[..data..]
This came from a <form> with two text inputs "txtMessage" and "MAX_FILE_SIZE". The file input is called "file" and the name of the uploaded file "image.jpg".
I suppose you have to follow the format of this request. I doubt if the headers you mentioned in your initial post are enough.
Note that the header writes a boundary, and there are two additional dashes in the content:
---------------------------5272992921246
-----------------------------5272992921246
Replace [..content length..] with the length of all the output after the initial header.
Replace [..data..] with your gziped data
Replace Host: localhost:1234567 with the URL of the PHP page that will handle the upload. The port (:1234567) is not necessary.
Referer cookies and other headers are probably not critical for your implementation. I copy-pasted them all so that you can have a better understanding.
The PHP script that will handle this upload should behave exactly like any regular upload. So read the examples in http://us3.php.net/features.file-upload for more. Also, there are several other pages in php.net to explain how to unzip or gunzip. You will find lots of examples.