expressjs / expressjs/multer

Not have an array, but just one object, when maxcount is 1

Open
#854 4 comments 0 reactions 0 assignees View on GitHub
discuss enhancement
Dominant language
JavaScript
Stars
12.1k
Forks
1.1k
Avg merge
8d 2h
Merged PRs (30d)
21

Description

When using fields, for fields that have a maxCount of 1, don't have an array but a sigle file.
This makes coding much easier. For example, when having this:

````
const upload = multer().fields(
[
{ name: 'signed', maxCount: 1 },
{ name: 'generated', maxCount: 1 }
]
)
````

It would be much nicer to have `request.files.signed` to be an _object_.
Right now, you can do the same thing with `.single()`; however, you can only add one `single()` (you can't chain them).

I am asking now before you actually release 2.0, because this WOULD be a breaking change.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.