I know formidable has a form.maxFieldsSize
, but that doesn't include files. How would I limit the maximum file size uploaded to a multipart form in formidable, and terminate the form if the file size is too large?
I think you can use the code down below for that kind of task.
var sizeLimitBytes = 2000;
form.on('progress', function(bytesReceived, bytesExpected) {
if(bytesReceived > sizeLimitBytes ){
return false; //exit the program
}
});