Expressjs bodyParser和连接forms

我用连接forms上传图像。 但是,如果我使用bodyParser()它是行不通的。 而相反,如果我不使用bodyParser,我不能上传文件?

我如何让他们一起玩? 这是我的configuration:

 app.configure(function() { app.register('.html', require('ejs')); app.set('views', __dirname + '/../views'); app.set('view engine', 'html'); app.use(gzippo.staticGzip(__dirname + '/../public'),{ maxAge: 86400000 }); app.use(express.bodyParser()); app.use(express.methodOverride()); app.use(form({ keepExtensions: true, uploadDir: __dirname + '/../tmp' })); app.use(express.cookieParser()); app.use(express.session({ secret: 'test', cookie: { secure: true }, store: new MySQLSessionStore(client.database, client.user, client.password) })); app.use(expressValidator); app.use(app.router); app.use(express.csrf()); }); 

       

网上收集的解决方案 "Expressjs bodyParser和连接forms"