关于req.body
发布于 9 年前 作者 carly1987 4372 次浏览 最后一次编辑是 8 年前 来自 问答

Request URL:http://localhost:10001/mod/upload Request Method:POST Status Code:200 OK Request Headers (12) Form Dataview parsed {“files”:{“webkitRelativePath”:"",“lastModified”:1421799831000,“lastModifiedDate”:“2015-01-21T00:23:51.000Z”,“name”:“qrcode_for_gh_89284a8fabf6_430.jpg”,“type”:“image/jpeg”,“size”:40319}}

这个post,为什么我取req.body的时候,得到的却是: { ‘{“files”:{“webkitRelativePath”:"",“lastModified”:1421799831000,“lastModifiedDate”:“2015-01-21T00:23:51.000Z”,“name”:“qrcode_for_gh_89284a8fabf6_430.jpg”,“type”:“image/jpeg”,“size”:40319}}’: ‘’ } json数据传递后为什么变成了键值对呢。 求解决,,求大神们,,,

3 回复

bodyparse 的 extend 选项打开没有

@alsotang 不是很明白呢。 说明下呢

我知道我哪里错了。但是我把这个问题跳过以后,出现了以下的错误: Request URL:http://localhost:10001/mod/upload Request Headers Provisional headers are shown Accept:/ Content-Type:application/x-www-form-urlencoded; charset=UTF-8 Origin:http://localhost:10001 Referer:http://localhost:10001/admin/single?id=54cb51a87ea78ca119284bdd User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.111 Safari/537.36 X-Requested-With:XMLHttpRequest Form Dataview sourceview URL encoded name:1-3.JPG size:524097 path:C:\fakepath\1-3.JPG。 汗,只能放弃ajax,用iframe了

回到顶部