Images.insert(...
from the frontend is great for in this case I have already the binary data in a var in the backend. How do I write it to a file? CollectionFS can help me with that?
<template name="hello">
Add Files<br>
<form class="input">
<input type="text" id="theName" name="theName"/>
<span class="btn btn-default btn-file">
<input multiple class="file fileInput" type="file"/>
</span>
<input type="submit" value="Add To Collection"/>
</form>
<br>
{{#each uploads}}
<br>
User: {{email}}
<br>
Filename: {{name}}
<br>
Description: {{theName}}
<br>
<a class="btn btn-primary" href="{{url download=true}}">Download</a>
<br>
{{/each}}
</template>
Template.hello.events({
'submit form': function(event, template){
event.preventDefault();
var theName = event.target.theName.value;
FS.Utility.eachFile(event, function(file){
var currentUserId = Meteor.userId();
var fileObj = new FS.File(file);
fileObj.itemtext = theName;
fileObj.userId = currentUserId;
fileObj.email = Meteor.user().emails[0].address;
Uploads.insert(fileObj, function(err){
console.log(err);
})
})
}
Hi all, have a strange problem
var image = Images.findOne({_id: photo._id});
var url = image.url("Images");
console.log(image);
onsole.log(image.url("Images"));
url method returns null, but when i set a timeout it returns url (image displays fine)
anybody knows where is a problem?
MongoError: auth failed