whatsapp-api-tutorial icon indicating copy to clipboard operation
whatsapp-api-tutorial copied to clipboard

Express-file-upload: Request is not eligible for file upload! TypeError: Cannot read property 'replace' of undefined

Open ramaadit1234567 opened this issue 4 years ago • 1 comments

ada pesan error pada saat send media file. di console.log(file) muncul error seperti di gambar ini. minta bantuannya mas.

Untitled

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
    });
});

});

ramaadit1234567 avatar Jul 19 '21 09:07 ramaadit1234567

Dari pesan errornya, terlihat bahwa data number belum dikirim, sehingga nilai dari req.body.number kosong. Sangat disarankan untuk mengikuti tutorial terlebih dulu.

ngekoding avatar Jul 22 '21 01:07 ngekoding