// var upload = multer({ dest: 'public/uploads/' , fileFilter: fileFilter}); // 文件上传 router.post('/upload.api',upload.single('upfile'),function(req,res,next){ console.log(req.file); res.set('Content-Type', 'text/plain'); res.send({ "state": "SUCCESS", "url": req.file.path.slice(req.file.path.indexOf('/') + 1), "title": req.file.fieldname, "original": req.file.originalname }) });