Meteor - collectionfs fileinput "DataMan constructor received data that it doesn't support"?

726 views Asked by At

I am trying to enter a file into my DB that has user info attached to it. I keep getting a DataMan error and not sure how to work around. "DataMan constructor received data that it doesn't support"

Here is the code I am working with

'change .fileInput': function (event, template) {
    FS.Utility.eachFile(event, function (file) {
    var fileObj = new FS.File(file);
    Images.insert({
        picture: fileObj,
        owner: Meteor.userId(),
        username: Meteor.user().username
    }, function (err) {
      console.log(err);
    });
 })
}

My thought was to do something similar to the Meteor documentation: http://docs.meteor.com/#/basic/Mongo-Collection-insert but with a file also...

Update: the following code does what I want essentially and works. Still curious about the above though.

'change .fileInput': function (event, template) {
    FS.Utility.eachFile(event, function (file) {
    var fileObj = new FS.File(file);
    fileObj.ownerId = Meteor.userId();
    Images.insert(fileObj, function (err) {
      console.log(err);

    });
  })
},
0

There are 0 answers