I\'m using Multer to upload images in Express 4. However, the examples all show Multer being defined in the express file as Middleware. I\'d like to actually define some of
Actually you can do what you want with another method:
var express = require('express');
var multer = require('multer');
var upload = multer({ dest: './uploads/'});
var app = express();
app.get('/', function(req, res){
res.send('hello world');
});
// accept one file where the name of the form field is named photho
app.post('/', upload.single('photho'), function(req, res){
console.log(req.body); // form fields
console.log(req.file); // form files
res.status(204).end();
});
app.listen(3000);