Search code examples
phpjavascripthttp-headersxmlhttprequest

Content-Transfer-Encoding in file uploading request


I'm trying to upload file, using XMLHTTPRequest, and sending this headers:

Content-Type:multipart/form-data, boundary=xxxxxxxxx

--xxxxxxxxx
Content-Disposition: form-data; name='uploadfile'; filename='123_logo.jpg'
Content-Transfer-Encoding: base64
Content-Type: image/jpeg
/*base64data*/

But on server side PHP ignore header "Content-Transfer-Encoding: base64" and write base64 undecoded data directly into the file!

Is there any way to fix it?

p.s. it is very important to send data using base64


Solution

  • My previous answer was wrong

    Content-Transfer-Encoding may appear in the a composite body

    http://www.ietf.org/rfc/rfc2616.txt

    There are several consequences of this. The entity-body for composite types MAY contain many body-parts, each with its own MIME and HTTP headers (including Content-MD5, Content-Transfer-Encoding, and Content-Encoding headers).