limits: {
fieldNameSize: 100,
fileSize: 1024*1,
files: 1,
fields: 100
}
I use the options limit , and then upload a file which fileSize > 1024 bytes, but I don't know how to catch the error. Also the the file in fileFilter(req, file, cb), only has 4 properties
fieldname
originalname
encoding
mimetype
I couldn't use the property fileSize to filter the file.
{ [Error: File too large] code: 'LIMIT_FILE_SIZE', field: 'image', storageErrors: [] }
Error: File too large
Follow the Express error handling guide.