i got this error says
error:request entity too large
when uploading a video about 30MB,
here is the setting code
app.use(express.bodyParser({
uploadDir:'./Temp',
maxFieldsSize:'2 * 1024 * 1024 * 1024 ',
}));
am not sure how to set the maxFieldsSize property, need some help!!!
Express uses connect middleware, you can specify the file upload size by using the following
Connect Limit middleware
In 2020 Express uses the body-parser urlencoded function to control the limit. http://expressjs.com/en/4x/api.html#express.urlencoded
These are the default settings inside node_modules>body-parser>lib>types>urlencoded.js https://www.npmjs.com/package/body-parser
You can see here that the default setting for limit is 100kb. so in order to up that you can use
here are the filetype options available via NPM package bytes ( used by bodyparser ) https://www.npmjs.com/package/bytes
I'm sure this was overkill but I hope this helps the next person.
correct format for increasing file uploading size with multer in nodejs
I'm using Express 4. I tried numerous app.use() statements, including the non-deprecated ones listed on this thread, but none of them worked.
Instead, it turned out I only needed to add one line to index.js to change the maxFileSize option in the Formidable module:
Source: Comments from here.
But you must make sure you add this line above the below,
or
depending on which version you are using.