【发布时间】:2022-01-13 09:13:56
【问题描述】:
文件未保存在服务器上。 path 属性返回 undefined。
const uploadProfile = (req, res) => {
const form = formidable.IncomingForm();
form.uploadDir = `./images`;
form.keepExtensions = true;
form.parse(req, (err, fields, files) => {
if (err) {
return res.json("Formidable cannot parse the form");
}
console.log(files.image.path);
res.json(files.image.path);
});
};
【问题讨论】:
标签: javascript express file formidable