在给博客网站添加增加文件的功能时报错不知道什么原因
发布于 4 天前 作者 hank2015 119 次浏览 来自 问答

2015-12-29 15-42-31屏幕截图.png 2015-12-29 15-42-55屏幕截图.png package.json { “name”: “blog”, “version”: “0.0.0”, “private”: true, “scripts”: { “start”: “node ./bin/www” }, “dependencies”: { “body-parser”: “~1.13.2”, “connect-flash”: “^0.1.1”, “connect-mongo”: “^1.0.1”, “cookie-parser”: “~1.3.5”, “debug”: “~2.2.0”, “ejs”: “~2.3.3”, “express”: “~4.13.1”, “express-session”: “^1.12.1”, “markdown”: “^0.5.0”, “mongodb”: “^2.0.52”, “morgan”: “~1.6.1”, “multer”: “^1.1.0”, “serve-favicon”: “~2.3.0” } }

app.js: var multer = require(‘multer’); index.js: router.get(’/upload’, checkLogin); router.get(’/upload’, function (req, res) { res.render(‘upload’, { title: ‘文件上传’, user: req.session.user, success: req.flash(‘success’).toString(), error: req.flash(‘error’).toString() }); }); router.post(’/upload’, checkLogin); router.post(’/upload’, function (req, res) { req.flash(‘success’, ‘文件上传成功!’); res.redirect(’/upload’); });

回到顶部