This enctype="multipart/form-data" blocking me from sending my data to mysql but it is a must for multer to work. I\'m trying to store the image f
reference this
your data that inserted into database isn't on req.body object instead some where else.
like req.files.file
object. you can print out the log by using console.log('req.file' + req.file + 'req.files' + req.files) on your app.js file
app.post('/save',upload.single('featured_img'), function (req, res) {
console.log('req.file' + req.file + 'req.files' + req.files)
let sql = "INSERT INTO `music`(`featured_img`, `title`, `band_name`, `audio`) VALUES ('" + req.body.featured_img + "', '"+req.body.title+"', '"+req.body.band_name+"', '"+req.body.audio+"')";
let query = connection.query(sql, (err, results) => {
if(err) throw err;
res.redirect('/');
});
});
reference