不知道有哪些情况会导致files为空,fields 有值, 值为 {upload: 'test.png'}, test.png就是我上传的那张图片,请大家帮我看看,不甚感激
var form = new formidable.IncomingForm();
form.parse(request, function (error, fields, files){
console.log(files);
fs.renameSync(files.upload.path, 'temp/test.png');
response.writeHead(200,{'Content-Type': 'text/html'});
response.end('<img src="/show">');
});
伊谢尔伦2017-04-17 12:03:59
https://cnodejs.org/topic/50234890f767cc9a51f88481
這個貼文裡面可能有你需要的東西,我也遇到了這樣的問題
PHPz2017-04-17 12:03:59
如果是看這個網址www.nodebeginner.org/index-zh-cn.html學習的話:
應該把sever.js裡下面這行程式碼註解掉就可以了
request.setEncoding(" utf8");