0

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

Greko2009
  • 443
  • 1
  • 5
  • 11

0 Answers0