File size limit cancels file upload only after all bytes are received
See original GitHub issueI’ve been using multer for file uploads, and I’ve noticed an issue with the file size limit. I’m using the limits option to prevent the upload of files that are too large.
const upload = multer({
storage: multer.memoryStorage(),
limits: {
fieldNameSize: 255,
fileSize: 500000,
files: 1,
fields: 1
}
});
When uploading an image to my API, multer seems to wait until it has received all of the image bytes before failing with the “LIMIT_FILE_SIZE” code.
Isn’t it a security vulnerability if your API allows someone to upload an arbitrarily large file before failing the request? Is there another technique for preventing the behavior?
Issue Analytics
- State:
- Created 7 years ago
- Reactions:45
- Comments:31 (8 by maintainers)
Top Results From Across the Web
How to limit the file size when uploading with multer?
This all works fine and the file gets uploaded. The only thing that is not working is the limit on the max size....
Read more >File Upload example has limit of 2048 bytes — oracle-tech
I am following an example on how to perform a file upload from a JSF page in Frank ... InputStream.read(buffer) stops reading at...
Read more >File Size Limit Exceeded Error Under Linux and Solution
I am getting an error “file size limit exceeded” under Linux. ... size (kbytes, -m) unlimited open files (-n) 1024 pipe size (512...
Read more >Attach large files to Outlook messages or events
If the file size is between 3 MB and 150 MB, create an upload session, and iteratively use PUT to upload ranges of...
Read more >How to Increase the Max Upload Size in WordPress - Kinsta
A low WordPress upload size limit stops you from uploading large files, plugins, and themes. If you're building a media-heavy website, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Is there any update in regards to this issue? Does this really persist since 2016?
PR sent: https://github.com/expressjs/multer/pull/447