Answers for "how to set file type and size in multer"

0

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.
  })
})
Posted by: Guest on August-17-2020

Code answers related to "how to set file type and size in multer"

Code answers related to "Javascript"

Browse Popular Code Answers by Language