I have image collection like this (Coffee Script)
@Image = new FS.Collection("Image",
stores: [
new FS.Store.FileSystem("images", {path: Meteor.settings.imagesUpload}),
]
)
and I want to upload file from file system.
Used CFS with following packages
cfs:filesystem cfs:standard-packages
Simple snippet on server (Coffee Script)
fd = new FS.File()
fd.attachData("/path/to/file.png", (error) ->
Image.insert(fd, (error, fileObj) ->
console.log(error, fileObj)
)
)
or just like that (Coffee Script)
Image.insert("path/to/file/or/URL", (error, fileObj) ->
console.log(error, fileObj)
)
You can also upload file from URL with authentication, read more here.