Answers for "multer set file size limit"

PHP
2

php get size of file

$fileSizeInBytes=filesize("/path/to/myfile.txt");
Posted by: Guest on October-22-2019
1

how to limit the file size in multer

var upload = multer({
  storage: storage,
  limits: { fileSize: maxSize } // filesize in bytes

}).single('bestand');
Posted by: Guest on December-09-2020
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

Browse Popular Code Answers by Language