[英]Can somebody help me TypeError: Cannot read property 'map' of undefined
[英]Cannot read property 'path' of undefined, can anybody please help me to resolve this
我需要将 List<Map<String, String>> 作为 REST GET API 的参数传递。 我需要帮助才能知道如何从 Postman 或类似工具传递。
我试图将它设置为 GET API 的 BODY,它给了我错误。
var http = require('http');
var formidable = require('formidable');
var fs = require('fs');
http.createServer(function(req, res) {
if (req.url == '/fileupload') {
var form = new formidable.IncomingForm();
form.parse(req, function(err, fields, files) {
var oldpath = files.filetoupload.path;
var newpath = 'D:/nodejs/images/' + files.filetoupload.name;
fs.rename(oldpath, newpath, function(err) {
if (err) throw err;
res.write('File uploaded and moved!');
res.end();
});
});
} else {
res.writeHead(200, {
'Content-Type': 'text/html'
});
res.write('<form action="fileupload" method="post" enctype="multipart/form-data">');
res.write('<input type="file" name="filetoupload"><br>');
res.write('<input type="submit">');
res.write('</form>');
return res.end();
}
}).listen(3000);
GET 请求消息中的有效负载没有定义的语义; 在 GET 请求上发送有效负载正文可能会导致某些现有实现拒绝该请求。 我建议使用 POST 方法而不是 GET
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.