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.
- upload the screenshot of the picture first
2.
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