node.js - I am trying to send array of images but I am unable to get data in server using nodejs -


here plunker link https://plnkr.co/edit/0i0bbymoekwpyixsofju?p=catalogue

i want know how upload array of images.

for single file, it's working, multiple files want know need write in node js.

my code

router.route('/events') .post(upload.single('event_image'),function(req,res){  console.log('**inside create events**'); console.log(":req.body",req.body); console.log(":req.fileeeeeee",req.body); var event = new event(); event.name = req.body.name; event.description = req.body.description; event.location = req.body.location; event.startdate = req.body.startdate; event.enddate = req.body.enddate; event.tagline = req.body.tagline; event.password = req.body.password; event.passcode = geteventpasscode(); event.uid = req.body.user_id; }) 

use upload.array('event_images', 20) (20 maxcount) instead of upload.single('event_image')

edit: here code snippet shows working route in node.js

router.post('/upload',  function(req, res) {   upload.array('event_images', 20),   function(req, res) {     _.each(req.files, file => {       console.log(file.path);       console.log(file.name);     });     res.json();   } ); 

Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -