我正在尝试通过我的流星集合找到一种将mp3文件上传到mongo集合的方法。它有点挑战,因为我最终得到了" C:\ fakepath \ audio.mp3"正如集合中保存的内容一样。
非常感谢任何帮助。 感谢。
答案 0 :(得分:3)
您正在寻找FSCollection Package和GridFS
存储适配器。
开始在控制台上运行它。
meteor add cfs:standard-packages
meteor add cfs:gridfs
现在使用fsCollection,你可以简单地上传文件。
首先
声明收藏。
AudioCollection = new FS.Collection("AudioCollection", {
stores: [new FS.Store.GridFS("AudioCollection")]
});
创建一个简单的Event handler
。
Template.example.events({
'click #example':function(e,t){
//Simple Event to upload files into mongo.
}
})
做一个简单的helper
Template.example.helpers({
showAudio:function(){
return AudioCollection.find();
}
})
使用此 HTML
{{each showAudio}}
{{#if isAudio}}
<!-- show whatever you want here -->
{{/if}}
{{/each}}
由于README它此时为空,我做了一个样本DEMO。