I am using the express-fileupload
module to upload pdf files and store into mysql database. I can only upload pdf files < 10mb. I want to allow a bigger bandwidth of files to be uploaded e.g 50mb.
Here is my router:
app.use(fileUpload({ limits: { fileSize: 50 * 1024 * 1024 } })); // needed for file upload
app.use(bodyParser.json({ limit: '50mb' }));
app.use(bodyParser.urlencoded({
limit: '50mb',
extended: true
}));
I can see my file is 100% uploaded on the chrome browser upload bar however my app crashes soon after that with this error:
events.js:183 throw er; // Unhandled 'error' event
Error: Can't write in closed state
I have tried increasing the connection timeout for mysql, i.e to 600000, however still facing the same issue.