How to cancel user upload in Formidable (Node.js)?

后端 未结 8 1101
[愿得一人]
[愿得一人] 2021-02-07 22:14

I have been working on this problem for two days now, and I am stuck. I am using Node.js with Express, and I am trying to implement an upload form. Basically, I want the form to

相关标签:
8条回答
  • 2021-02-07 23:12

    Form.pause actually will prevent browser sending more data. Call below function did it for me:

    var closeConnection = function(res, form){
        try{
        if (!res.ended){
            form.onPart=null;
            form.pause();
            res.end();
            res.ended = true;
        }
        }catch(e){console.log(e);}
    }
    
    0 讨论(0)
  • 2021-02-07 23:14

    Some time has passed and now you can use multer instead of formidable or multiparty. Multer has desired functionality built in.

    0 讨论(0)
提交回复
热议问题