meteor - cfs:s3 how to get url after upload? -
i cannot understand how cfs:s3 work. on client have
images = new fs.store.s3('images') @images = new fs.collection "allimages", stores: [images] filter: allow: contenttypes: ['image/*']
on server same keys. , change event
"change .file-image": (e) -> console.log("changed!") fs.utility.eachfile e, (file) -> images.insert file, (err,fileobj) -> console.log 'fileobj',fileobj
and after cannot understand do, how upload , url?
when create cfs object you'll typically want retain _id
, example:
let imageid = images.insert file
or
images.insert file, (err,fileobj) -> let imageid = fileobj._id
cfs might take awhile finish loading file , url isn't available until upload finished.
let url = fileobj.isuploaded() ? fileobj.url() : null
in blaze might like:
{{#if this.isuploaded}} <a href="{{this.url}}">download file</a> {{else}} {{> progress}} {{/if}}
finally, cfs project getting less attention may wish switch edgee:slingshot
Comments
Post a Comment