const express = require('express');
const app = express();
const formidable = require('formidable');
app.post('/upload', (req, res) => {
let form = new formidable.IncomingForm();
form.parse(req, (err, fields, files) => {
if(err) {
console.log(err);
return res.send(err);
} else {
console.log(fields);
console.log(files);
return res.send(fields);
}
});
app.listen(8080, () => console.log('App is running');
以下代码很长一段时间后会引发错误。错误是-
Error: Request aborted
请求通过邮递员以form-data
正文发送,字段为description
(文本)和input
(文件)