Hello guys,
i am trying to upload images via forms. For that i am using the FSCollection package. The image “objects” will be inserted to my mongo but the image url is strange:
<img src"/cfs/files/images/g3M7abyCtL5Y295HY/test_photo.jpg?token=eyJhdXRoVG9rZW4iOiJDbFpINjlSaTR6Mll6S0lwelo4ZC02WkxBSndDTzBmdndpcmZXeGd2T1hoIn0%3D&store=images">
Why the package saves the image there? I set the PATH to ~/uploads
. Any ideas?
My Code:
// collections/images.js
Images = new FS.Collection('images', {
stores: [ new FS.Store.FileSystem('images', { path: '~/uploads' }) ]
});
Images.allow({
'insert': function () {
return true;
},
'update': function () {
return true;
}
});
// client/views/AccountEdit.js
Template.AccountEdit.events({
change [data-id=avatar]': function(event, template) {
Images.insert(event.target.files[0], function (err, fileObj) {
if (err) {
console.log(err);
} else {
console.log(fileObj);
}
});
});