如何将节点响应流对象传递给事件处理函数?

时间:2015-07-06 13:13:58

标签: node.js

我想知道如何将响应节点流对象传递给form.on()以便已经上传的文件的名称将显示在屏幕上。

 var formidable = require("formidable");

 function upload(response, request) {
    var form = new formidable.IncomingForm();


        form.on('fileBegin', function(name, file, flower) {
        file.path = './uploads/' + file.name;
        var flowerImage = file.name ;
        response.writeHead(200, {"Content-Type": "text/html"});
        response.write("image name is " + flowerImage);
        response.end();

       });

}

0 个答案:

没有答案