Content-Transfer-Encoding in file upload request [英] Content-Transfer-Encoding in file uploading request

查看:161
本文介绍了Content-Transfer-Encoding in file upload request的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用XMLHTTPRequest上传文件,并发送此标题:

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*/

但是在服务器端PHP忽略标题Content-Transfer-Encoding:base64
并将base64未解码的数据直接写入文件!

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

有没有办法解决它?

ps使用base64发送数据非常重要

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

推荐答案

实际上HTTP
中没有内容传输编码见

In fact there is no Content-transfer-encoding in HTTP see

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


19.4.5无内容转移编码

19.4.5 No Content-Transfer-Encoding

HTTP不使用RFC 2045的
Content-Transfer-Encoding(CTE)字段

HTTP does not use the Content-Transfer-Encoding (CTE) field of RFC 2045.

但您可以使用base64_decode,如 http:// php .net / manual / en / function.base64-decode.php

but you can use base64_decode as in http://php.net/manual/en/function.base64-decode.php

这篇关于Content-Transfer-Encoding in file upload request的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆