Whisher
Whisher

Reputation: 32716

node express + formidable + form with multipart/form-data how to get req.body?

I'm using mean stack

and formidable to upload file

the form has a multipart/form-data attribute

exports.create = function(req, res) {
    console.log(req.body);
}

but the rq.body is empty. How can I get it ?

Upvotes: 2

Views: 4348

Answers (1)

Anubhav Gupta
Anubhav Gupta

Reputation: 560

If you are using formidable for multipart upload, you can get req.body fields in

form.parse(req, function(err, fields, files) 

fields.item

Upvotes: 1

Related Questions