Home >Backend Development >PHP Tutorial >javascript - post上传完 返回format: request Content-Type isn't multipart/form-data

javascript - post上传完 返回format: request Content-Type isn't multipart/form-data

WBOY
WBOYOriginal
2016-06-06 20:24:335639browse

post上传MP3完 返回错误文本是这个
{"error":"invalid multipart format: request Content-Type isn't multipart/form-data"}

这是哪里的错误 好像说的是说:内容类型不是multipart/form-data”的意思

回复内容:

post上传MP3完 返回错误文本是这个
{"error":"invalid multipart format: request Content-Type isn't multipart/form-data"}

这是哪里的错误 好像说的是说:内容类型不是multipart/form-data”的意思

你在包头没有写入content-type类型。 建议抓下包看下,或是用浏览器的调试模式看下

上传文件要指定Content-Type,比如php用curl上传文件
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);$data 需要为数组,而不是字符串

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn