1082180
我按照教程用的是formidable, 安装成功 引用文件没有问题,是最新版的。 根据教程和对比官方教程 就是设置不成功啊
function plug_file(req,res){//失败啊
if (req.url == '/plug_file' && req.method.toLowerCase() == 'post') {
// parse a file upload
var form = new formidable.IncomingForm();
form.parse(req, function(err, fields, files) {
res.writeHead(200, {'content-type': 'text/plain'});
res.write('received plug_file:\n\n');
res.end(sys.inspect({fields: fields, files: files}));
});
return;
}
// show a file upload form
res.writeHead(200, {'content-type': 'text/html'});
res.end(
'<form enctype="multipart/form-data" '+
'method="post">'+
'<input type="file" name="plug_file" multiple="multiple"><br>'+
'<input type="submit" value="Upload">'+
'</form>'
);
}
到底什么地方有错啊? 上传后的结果就是
received plug_file:
{ fields: {}, files: {} }
但是教程里面上传成功会返回N多东西 为神马啊啊啊啊啊