我无法使用 Connect 框架上传文件。我参考了链接Connect。下面是我的代码
app.use(connectDomain())
.use(connectRoute(function (router) {
router.post('/upload', function (req, res) {
var form = new formidable.IncomingForm();
form.parse(req, function (err, fields, files) {
res.writeHead(200, {'content-type': 'text/plain'});
res.write('received upload:\n\n');
res.end(JSON.stringify({fields: fields, files: files}));
});
我总是得到如下响应
received upload:
{"fields":{},"files":{}}