3

我想将文件上传到 Meteor 应用程序,一旦在服务器上处理了上传的文件,就向客户端(仅向上传文件的人)推送一些关于成功上传的通知。我想我知道如何通过连接到 Express 来进行文件上传,但是我如何只向这个客户端推送(或回调)?

4

1 回答 1

0

使用方法:http ://docs.meteor.com/#methods_header

服务器端js

Meteor.methods({
    'mytask' : function(var1,var2) { 
        //do stuff
        return {url:'a url'};
    }
});

客户端js

//Run this to call the method
Meteor.call("mytask", "www.google.com", "www.bing.com", function(err, result) {
    if(!err) {
        alert(result);
    }
}
于 2013-03-14T08:43:09.003 回答