multer limits file type and size code example
Example 1: how to limit the file size in multer
var upload = multer({
storage: storage,
limits: { fileSize: maxSize } // filesize in bytes
}).single('bestand');
Example 2: how to set file type and size in multer
var multer = require('multer')
var upload = multer().single('avatar')
app.post('/profile', function (req, res) {
upload(req, res, function (err) {
if (err instanceof multer.MulterError) {
// A Multer error occurred when uploading.
} else if (err) {
// An unknown error occurred when uploading.
}
// Everything went fine.
})
})