'Object: null prototype {}--multer
It seems that when multer is handling the body req it's not getting the information and I'm getting that error above but when I don't use multer every thing is great, this is my code:
router.post("/", upload.single("image"), async (req, res) => {
console.log(req.body);
let post = new Post({
title: req.body.title,
desc: req.body.desc,
image: req.body.filename,
});
try {
post = await post.save();
res.status(201).redirect("/posts");
} catch (err) {
console.log(`upload.single error: ${err}`);
}
});
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
