Closed boypanjaitan16 closed 4 years ago
I tried like the example but nothing working about setting metadata.
const upload = multer({ storage: multerS3({ s3 : s3, bucket : 'teduhku', contentType : multerS3.AUTO_CONTENT_TYPE, metadata : function (req, file, cb) { console.log(req.body); cb(null, Object.assign({}, req.body)); }, key : function (req, file, cb) { console.log(req.params); const exp = file.originalname.split('.'); //const fname = req.params.title.replace(/[^0-9a-zA-Z.]/g, '-').toLowerCase(); const ext = exp.pop().toLowerCase(); cb(null, `${Date.now().toString()}.${ext}`); } }) });
and this is how triggered
app.post('/music/upload', upload.array('files', 3), (req, res) => { res.json({ 'status' : 'success' }); });
the error sai that req.params.title is undefined, bu I pretty sure that i set the field from the form
req.params.title
never mind, I got it
I tried like the example but nothing working about setting metadata.
and this is how triggered