CollectionFS changes image filename


#1

Hey, so I’m using this package for image upload and I have two problems.

  1. It stores the images at .meteor\local\cfs\files\uploads with modified name, such as “uploads-3CWrj7eC94WWryFx5-IMG_0784.JPG”, but on the database it stores the real image name. How can I make the database to have the same name?
  2. At the moment the image is uploaded on the spot, and I want it to be uploaded only after I press submit.
    I’m using regular html form.
    I’m new with this, so any help would be appreciated

This is my js code:

var Uploads = new FS.Collection(“uploads”, {
stores: [new FS.Store.FileSystem(“uploads”)]
});

Uploads.allow({
‘insert’: function () {
return true;
}
});

if(Meteor.isClient){
Template.myForm.helpers({
uploads: function(){
return Uploads.find();
}
});
}

if(Meteor.isClient){
Template.myForm.events({
‘change .fileInput’: function(event, template) {
FS.Utility.eachFile(event, function(file){
var fileObj = new FS.File(file);
Uploads.insert(fileObj);

})
}
})