How to limit upload file size in express.js

express, node.js, upload

Solution

Express uses connect middleware, you can specify the file upload size by using the following

app.use(express.limit('4M'));

Connect Limit middleware

Problem

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!!!

Original source

Related problems