[question] File too large error when file is exactly the size of fileSize
- Dominant language
- JavaScript
- Stars
- 12.1k
- Forks
- 1.1k
- Avg merge
- 8d 2h
- Merged PRs (30d)
- 21
Description
I would like to allow files up to and including 10mb (10,485,760 bytes) and have specified `fileSize` with this number of bytes. When I tried uploading a file exactly 10485760 bytes in size, I received the "File too large" error. If I increase `fileSize` by 1 byte then I can upload the file.
Should I specify `fileSize` with a number 1 byte large than my intended maximum allowed file size?
Multer verson:
`"multer": "^1.4.5-lts.1"`
Code:
```
const storage = multer.memoryStorage();
const maxSize = 10 * 1024 * 1024; // 10MB
const upload = multer({ storage, limits: { fileSize: maxSize } }).any();
...
upload(req, res, (err) => {
if (err) {
logger.error(`${err?.message ? err?.message : err}`);
}
...
}
```
File used:
[10mb.txt](https://github.com/expressjs/multer/files/9315443/10mb.txt)
Contributor guide
Assessment
This issue has not been assessed yet.