Skip to content

Commit

Permalink
fix: Use fileBegin hook to properly fail when maxFiles is exceeded (#881
Browse files Browse the repository at this point in the history
)

fix: Use fileBegin hook to properly fail maxFiles
  • Loading branch information
coloursofnoise committed Aug 22, 2022
1 parent 81dd350 commit d285a08
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Formidable.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit d285a08

Please sign in to comment.