Meteor-Files: this.userId is not always available onBeforeUpload

I am trying to validate the user in onBeforeUpload:

 onBeforeUpload: function (file) {
    console.log(this.userId);
}

But on the server it outputs 3 lines for a single upload:

I20160830-12:46:55.587(2)? undefined
I20160830-12:46:55.820(2)? LSmRXxxkSs9RrPfN4
I20160830-12:46:55.832(2)? LSmRXxxkSs9RrPfN4

Two questions, one is why it calls three times? second is why the first time this.userId is not defined? Thanks.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 20 (11 by maintainers)

Commits related to this issue

Most upvoted comments

@dr-dimitru It worked for me, thanks.