2017-01-10 87 views
0

我在Meteor中使用了這個包nodemailer。 收到郵件後,我想用Meteor Files保存附件。 問題是我不知道如何。任何人都可以提供一個簡單的例子來上傳服務器代碼中的文件。我嘗試在客戶端上傳併成功。但是,當我在服務器中嘗試Files.insert()時,它有「沒有功能」的錯誤。使用流星文件在服務器上傳文件veliov組

這裏是我的服務器代碼,

var mailparser = new MailParser({ 
    streamAttachments: true 
}); 
Fiber(function() { 
    var timeStamp = Math.floor(Date.now()); 
    mailparser.on("attachment", function(attachment, mail){ 
     ... code here to upload 
     mailparser.on("end", Meteor.bindEnvironment(function (mail_object) { 
      .... some code here 
     })); 
     mailparser.write(data); 
     mailparser.end(); 
     client.dele(msgnumber);  
    }).run(); 
+0

在你的描述中你提到「當我試過Fiels.insert()..」但這不是你提供的代碼 – Mikkel

+0

現在已經修復。我使用了文件的寫入功能。 – JMA

+0

@JMA你能否分享你的解決方案作爲這個問題的答案? – Waqas

回答