使用Meteor将文件插入mongo DB

时间:2015-08-07 20:07:53

标签: mongodb meteor

我想使用流星帧工作将imges插入到mongo db中。为此,我编写了这段代码来创建文件对象。

'change .inputFile': function(event, template) {
FS.Utility.eachFile(event,function(file){
var file=FS.File(file)
alert("file :"+file)
})

当我尝试创建文件对象时,它显示以下错误:

TypeError: self.attachData is not a function.

1 个答案:

答案 0 :(得分:1)

看看这一行:

file

这不起作用。在您将file定义为新var时,右侧的'change .inputFile': function(event, template) { FS.Utility.eachFile(event,function(file){ var fileObj = FS.File(file) alert("file :", fileObj) }) }) 未定义。试试这个:

enum Views: String {
    case view1 = "View1" // Change View1 to be the name of your nib
    case view2 = "View2" // Change View2 to be the name of another nib

    func getView() -> UIView? {
        return NSBundle.mainBundle().loadNibNamed(self.rawValue, owner: nil, options: nil).first as? UIView
    }
}