Meteor - collectionfs fileinput "DataMan constructor has received data it does not support"?

I am trying to inject a file into my DB that has user info bound to it. I keep getting DataMan error and don't know how to work. "DataMan Constructor has received data that it does not support"

Here is the code I am using

'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 the file also ...

Update: The following code does what I want essentially and works. However, everyone is still wondering about it.

'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);

    });
  })
},

      

+3


source to share





All Articles