multer
multer copied to clipboard
Allow passing function to limits.fileSize
Instead of passing a hard-coded value, We can also pass a function and get the file size dynamically.
Example: Each user can have a different max file size.
const upload = multer({
storage,
limits: {
fileSize: (req) => {
return req.storage.maxFileSize;
},
},
});