I'm writing an web application that allow user to upload very large file (up to GB). My technical stack include: nodejs, express, multer and pure html. It works fine for small file. But when I upload big file (127 MB), I got error ERR_CONNECTION_RESET after waiting a while (about 2 minutes ).
I tried extended response time on server, using both req.setTimeout and res.setTimeout but it didn't help. It's may be because frontend waiting to long to get response.
Below is the error I got:
Thank you all.
Increasing the res
-timeout for the corresponding upload-route should definitely work. Try doing it like this:
function extendTimeout (req, res, next) {
// adjust the value for the timeout, here it's set to 3 minutes
res.setTimeout(180000, () => { // you can handle the timeout error here })
next();
})
app.post('/your-upload-route', extendTimeout, upload.single('your-file'), (req, res, next) => {
// handle file upload
})
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.