I have a task to upload user data in bulk through csv file. I am using nodejs
and express
framework. When i submit csv file having 60 to 70 rows it
As others mention, you'll need to set the parameterLimit
to deal with the "too many parameters" error. You may also need to set the limit
to a larger size to avoid a load size error. In the case of CSV, the urlencoded limits will be applied, but others may also want to set the JSON limits too. The following setting will work unless there are other places in the code that are overriding these settings:
var bodyParser = require('body-parser');
app.use(bodyParser.json({limit: '50mb'}));
app.use(bodyParser.urlencoded({limit: '50mb', extended: true, parameterLimit: 1000000}));
I'm not sure where you guys are testing your API but for me it was because I set the Content-Type
header to application/x-www-form-urlencoded
in Postman. Once I removed the header and used form-data
under the body section, it solved the issue. Make sure to always use form-data
when uploading files.
Hope it helps...
In your code it you are not using the parameterLimit
at all, as pointed out as in the blog posted you linked.
var bodyParser = require('body-parser');
app.use(bodyParser.urlencoded({
extended: false,
parameterLimit: 1000000 // experiment with this parameter and tweak
}));