I created this small example to find out where the form data end up, but I can't figure out where.
I would expect to find some data in req.body
, but as you see if you run the example, if comes out empty :/
var connect = require('connect');
var bodyParser = require('body-parser');
var app = connect();
app.use(bodyParser.urlencoded({'extended': false}));
app.use(function(req, res){
console.log(req);
res.end("<html><form method='post'enctype='multipart/form-data'><input type='text' name='file_caption' /><input type='file' name='file_file' /><input type='submit' /></form></html>");
});
app.listen(3000);
The thing is, if I use connect-busboy to access the input and file I find them. But why aren't they visible in the request object?
body-parser
doesn't provide any middleware to handle multipart requests. For that you need something like multer (multipart only), busboy/connect-busboy, or multiparty.