whatsapp-api-tutorial
whatsapp-api-tutorial copied to clipboard
Express-file-upload: Request is not eligible for file upload! TypeError: Cannot read property 'replace' of undefined
ada pesan error pada saat send media file. di console.log(file) muncul error seperti di gambar ini. minta bantuannya mas.

berikut kodingan saya di bagian send-media
// send media app.post('/send-media', (req, res) => { const number = phoneNumberFormatter(req.body.number); const caption = req.body.caption; const file = req.files.file;
console.log(file);
return;
client.sendMessage(number, media, { caption: caption }).then(response => {
res.status(200).json({
status: true,
response: response
});
}).catch(err => {
res.status(500).json({
status: false,
response: err
});
});
});
Dari pesan errornya, terlihat bahwa data number belum dikirim, sehingga nilai dari req.body.number kosong. Sangat disarankan untuk mengikuti tutorial terlebih dulu.