[expess4] File upload, large files are automatically disconnected and unresponsive

Code first
let form = new formidable.IncomingForm({
    encoding: "utf-8",
    uploadDir: "uploads/",
    keepExtensions: true
});
form.on("progress", function(bytesReceived, bytesExpected) {
    console.log("[progress]: ",bytesReceived, bytesExpected); 
}).on("file", function(name, file) {
    console.log("[file]: " ,name)
    res.send(file) 
}).on("end", function() { 
    console.log("[end]: ");
}).on("error", function(err) {
    console.error(":", err.message); 
    next(err); 
}).parse(req)

this is the upload code using the formidable module. I have also tried multer . The result is that it is no problem to upload ordinary image files less than 5m. As soon as the file is large, such as a 20m video, it will be disconnected automatically.

  1. upload the screenshot of the picture first

clipboard.png

clipboard.png

2.

clipboard.png

clipboard.png

The video of

24m stops when it reaches 5m and stops there, and the API directly returns no response.

I think this may be how the express framework needs to configure the size of the uploaded file or something. It should not be a problem of module or writing. Ask God to tell


are you calling the interface through postman? this question is generally related to the setting of postman

.
Menu