【发布时间】:2016-05-26 19:00:11
【问题描述】:
我正在使用 FS.Collection 将短视频文件上传到服务器上,然后将其作为电子邮件附件发送。
在服务器上插入集合可以工作,我可以在客户端访问集合项,也可以直接使用文件 URL 的路径进行流式传输 - localhost:3000/cfs/files/videos/{{item_id}}
我想知道如何访问服务器上的集合。我想以以下形式发送带有附件的电子邮件,并且需要访问服务器上文件和文件名的路径。我试着做:
Email.send({
to: to,
from: from,
subject: subject,
text: text,
attachments:[{fileName:"video.mp4", filePath:"/cfs/files/videos/{{item_id}}"}]
});
它在电子邮件中显示附件视频播放器,但带有错误消息,所以我认为我没有正确访问文件。
我的 Collection.js 很简单:
var videoStore = new FS.Store.GridFS("videos");
Videos = new FS.Collection("videos", {
stores: [videoStore]
});
【问题讨论】: