Send binary file using MSXML2.XMLHTTP to PHP without base64 encoding

77 views Asked by At

I am trying to figure out how to to send a binary file using multipart/form-data but without encoding it using base64 in order to save some size.

POST request is manually constructed and fed to MSXML2.XMLHTTP as a string like below:

// Content-Type: multipart/form-data; boundary=------------090708030009010000030901
// 
// --------------090708030009010000030901
// Content-Disposition: form-data; name="param1"
// 
// value1
// --------------090708030009010000030901
// Content-Disposition: form-data; name="param2"
// 
// value2
// --------------090708030009010000030901
// Content-Disposition: form-data; name="zipfile"; filename="zippeddata.zip"
// Content-Type: application/octet-stream
// 
// base64encoded(ZIP FILE DATA HERE)

The above method works fine but I'd like to save the overhead of base64.

What method/logic should I use to convert my binary data to a string and have PHP unzip the posted file without needing to decode base64.

Thanks

0

There are 0 answers