我无法理解 cfs:s3 是如何工作的。 在我的客户端上
images = new FS.Store.S3('images')
@Images = new FS.Collection "allImages",
stores: [images]
filter:
allow:
contentTypes: ['image/*']
在与 key 相同的服务器上。 并更改事件
"change .file-image": (e) ->
console.log("changed!")
FS.Utility.eachFile e, (file) ->
Images.insert file, (err,fileObj) ->
console.log 'fileObj',fileObj
毕竟它不明白该怎么做,如何上传和获取网址?
最佳答案
当您创建 cfs 对象时,您通常希望保留其 _id
,例如:
let imageId = Images.insert file
或
Images.insert file, (err,fileObj) ->
let imageId = fileObj._id
cfs 可能需要一段时间才能完成文件加载,但在上传完成之前该 URL 不可用。
let url = fileObj.isUploaded() ? fileObj.url() : null
在火焰中可能看起来像:
{{#if this.isUploaded}}
<a href="{{this.url}}">download the file</a>
{{else}}
{{> progress}}
{{/if}}
最后,由于 cfs 项目受到的关注越来越少,您可能希望切换到 edgee:slingshot
关于meteor - cfs :s3 how to get url after upload?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30563428/