Skip to content Skip to sidebar Skip to footer

How To Grab Formdata Being Passed From Ajax To Nodejs?

I am not sure where the code is wrong on the client or the server? It works if I do not send a FormData (req.body reads the info) but once I changed it to FormData since I am tryin

Solution 1:

according to the docs for BodyParser - for multi-part data uploads you have to use different modules, I chose formidable. https://github.com/expressjs/body-parser

var form = new formidable.IncomingForm({
          uploadDir: '_dirname',
          keepExtensions: true
        });

    // parse a file upload
    form.parse(req, function(err, fields, files) { })

Post a Comment for "How To Grab Formdata Being Passed From Ajax To Nodejs?"