Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong error triggered when number of fields exceed maxCount with .array(fieldname[, maxCount]) #402

Open
adrienbarreau opened this issue Oct 2, 2016 · 3 comments
Labels

Comments

@adrienbarreau
Copy link

I use upload.array('files', 5).

When I send from 1 to 5 files, everything works great !
But when I send 6 files I got the following error :
{ [Error: Unexpected field] code: 'LIMIT_UNEXPECTED_FILE', field: 'files', storageErrors: [] }

According to make-error.js I should get this code LIMIT_FILE_COUNT right ? Or am I missing something ?

@LinusU
Copy link
Member

LinusU commented Oct 2, 2016

I was just thinking about this the other day... It feels kind of strange to get LIMIT_UNEXPECTED_FILE actually.

As it is now, LIMIT_FILE_COUNT is only returned when the global (opposed to per-field) file limit is hit.

Changing this would be a breaking change, although I think it's a good change. I'll add it to the 2.0 alphas shortly, track progress here: #399

@LinusU
Copy link
Member

LinusU commented Oct 2, 2016

You can try it out right now with npm install --save multer@next 🎉

@adrienbarreau
Copy link
Author

Works great 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants