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
})
2条答案
按热度按时间hfsqlsce1#
增加相应的upload-route的
res
-timeout肯定会起作用。试着这样做:字符串
ghhaqwfi2#
经过几个小时的调试,我终于得到了一个工作解决方案:
关键是提高
server.requestTimeout
和server.headersTimeout
的值服务器上的文件头文件名:
最小值在
server.requestTimeout
或60000之间。