Express Multer Example

[Solved] Express Multer Example | Php Frameworks Yii - Code Explorer | yomemimo.com
Question : multer npm

Answered by : moise-mbakop

$ npm install --save multer file upload node 

Source : https://www.npmjs.com/package/multer | Last Update : Sat, 11 Apr 20

Question : multer in express.js

Answered by : zeamanual-feleke

const express = require('express')
const multer = require('multer')
const upload = multer({ dest: 'uploads/' })
const app = express()
app.post('/profile', upload.single('avatar'), function (req, res, next) { // req.file is the `avatar` file // req.body will hold the text fields, if there were any
})
app.post('/photos/upload', upload.array('photos', 12), function (req, res, next) { // req.files is array of `photos` files // req.body will contain the text fields, if there were any
})
const cpUpload = upload.fields([{ name: 'avatar', maxCount: 1 }, { name: 'gallery', maxCount: 8 }])
app.post('/cool-profile', cpUpload, function (req, res, next) { // req.files is an object (String -> Array) where fieldname is the key, and the value is array of files // // e.g. // req.files['avatar'][0] -> File // req.files['gallery'] -> Array // // req.body will contain the text fields, if there were any
})

Source : https://www.npmjs.com/package/multer | Last Update : Thu, 10 Mar 22

Question : express multer

Answered by : cloudy-crossbill-rqslofpo8wpb

$ npm install --save multer
var express = require("express");
var multer = require('multer');
var upload = multer({dest:'uploads/'});

Source : | Last Update : Thu, 03 Dec 20

Answers related to express multer example

Code Explorer Popular Question For Php Frameworks Yii