加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

php – 文件上传请求中的Content-Transfer-Encoding

发布时间:2020-12-13 18:13:45 所属栏目:PHP教程 来源:网络整理
导读:我正在尝试使用 XMLHTTPRequest上传文件,并发送此标头: Content-Type:multipart/form-data,boundary=xxxxxxxxx--xxxxxxxxxContent-Disposition: form-data; name='uploadfile'; filename='123_logo.jpg'Content-Transfer-Encoding: base64Content-Type: ima
我正在尝试使用 XMLHTTPRequest上传文件,并发送此标头:
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未解码的数据直接写入文件!

有没有办法解决它?

附:使用base64发送数据非常重要

事实上,HTTP中没有Content-transfer-encoding
看到

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

19.4.5 No Content-Transfer-Encoding

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

但您可以像http://php.net/manual/en/function.base64-decode.php一样使用base64_decode

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读