From d285a08425e5740dad0b58602646495ffb5a23be Mon Sep 17 00:00:00 2001 From: coloursofnoise Date: Mon, 22 Aug 2022 12:34:40 -0700 Subject: [PATCH] fix: Use fileBegin hook to properly fail when maxFiles is exceeded (#881) fix: Use fileBegin hook to properly fail maxFiles --- src/Formidable.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Formidable.js b/src/Formidable.js index 11aeda3c..01cc593e 100644 --- a/src/Formidable.js +++ b/src/Formidable.js @@ -599,7 +599,7 @@ class IncomingForm extends EventEmitter { _setUpMaxFiles() { if (this.options.maxFiles !== Infinity) { let fileCount = 0; - this.on('file', () => { + this.on('fileBegin', () => { fileCount += 1; if (fileCount > this.options.maxFiles) { this._error(