using multiparty with node js express

Solutions on MaxInterview for using multiparty with node js express by the best coders in the world

showing results for - "using multiparty with node js express"
Ibtissem
06 Jan 2018
1var express = require('express');
2var multiparty = require('connect-multiparty'),
3    multipartyMiddleware = multiparty({ uploadDir: './imagesPath' });
4
5var router = express.Router();
6
7router.post('/', multipartyMiddleware, function(req, res) {
8  console.log(req.body, req.files);
9  var file = req.files.file;
10  console.log(file.name);
11  console.log(file.type);
12  res.status(200).send('OK');
13});
14
15module.exports = router;