Content-Transfer-Encoding in file upload request

I am trying to upload a file using XMLHTTPRequest and submitting these 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 the server side, PHP ignores the header "Content-Transfer-Encoding: base64" and write unencrypted base64 data directly to the file!

Is there any way to fix this?

ps it is very important to send data using base64

+7
source share
2 answers

My previous answer was incorrect

Content-Transfer-Encoding may appear in a composite body

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

There are several consequences of this. An 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).

+2
source

Xavier's answer does not sound like that. RFC2616 also has this to say (section 3.7):

In general, HTTP processes a multi-page message body in no other way than any other type of medium: strictly as a payload. The one exception is "multicomponent / byteranges"

It seems to me that section 19.4 of RFC2616 talks about HTTP in general, in the sense that it uses a syntax similar to MIME (for example, the format of the headers), but not MIME-compatible,

In addition, there is RFC2388 . In section 3 , the last paragraph says:

Each part can be encoded, and the heading is "content encoding"

if the value of this part does not match the default encoding.

Section 4.3 details the following:

4.3 Coding

Although the HTTP protocol can transmit arbitrary binary data, the default 7BIT encoding is used for mail transport. The present value for the part may require coding and โ€œcontent transfer codingโ€, a header, if the value does not comply with the coding standard. See Section 5 of RFC 2046 for more details.]

+11
source

All Articles