DEV Community

TANMOY MANDAL
TANMOY MANDAL

Posted on

Multer s3 File Name cant't save to my mongodb

app
.route("/blog")
.get((req, res) =>
blog.find((err, data) => {
if (!err) {
res.send(data);
} else {
res.send(err);
}
})
)
.post( upload.array('photo',1), (req, res, next) => {

const newBlog = new blog({

  blog_title: req.body.blog_title,
  blog_content: req.body.blog_content,
  photo: ******  
});
newBlog.save((err,data) => {
  if (data) {
      console.log("successfully added new articles")
      console.log(req.body)
      console.log(req.files)
    res.send(data);
  } else {
    res.send(err);
  }
});
Enter fullscreen mode Exit fullscreen mode

});

I use Multer to post photo into the aws s3 it successfully post but i want to save post photo file name to my database. please help

Top comments (0)