multer icon indicating copy to clipboard operation
multer copied to clipboard

Allow passing function to limits.fileSize

Open hossein-zare opened this issue 2 years ago • 0 comments

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;
        },
    },
});

hossein-zare avatar Aug 28 '22 00:08 hossein-zare