javascript multer code example
Example 1: multer
var express = require('express')
var multer = require('multer')
var upload = multer({ dest: 'uploads/' })
var app = express()
app.post('/profile', upload.single('avatar'), function (req, res, next) {
})
app.post('/photos/upload', upload.array('photos', 12), function (req, res, next) {
})
var cpUpload = upload.fields([{ name: 'avatar', maxCount: 1 }, { name: 'gallery', maxCount: 8 }])
app.post('/cool-profile', cpUpload, function (req, res, next) {
})
Example 2: multer
var express = require('express')var app = express()var multer = require('multer')var upload = multer() app.post('/profile', upload.none(), function (req, res, next) {