veliovgroup / Meteor-Files

🚀 Upload files via DDP or HTTP to ☄️ Meteor server FS, AWS, GridFS, DropBox or Google Drive. Fast, secure and robust.
https://packosphere.com/ostrio/files
BSD 3-Clause "New" or "Revised" License
1.11k stars 166 forks source link

onAfterUpload is missing context #851

Closed kmoyse-apizee closed 1 year ago

kmoyse-apizee commented 1 year ago

Hello,

I'm using Meteor 2.7.3 and ostrio:files 2.3.0. I'm very happy with it so far : thanks !

Once a file has been uploaded I need to push some data to another collection, to state that a file has been uploaded by one user. I would like to use config.onAfterUpload for that purpose, but I'm missing the context with this.userId and this.user() as the other methods have (like config.onBeforeUpload for example).

Would it be possible to add it ?

Any other suggestion ?

I'm working on linux (Ubuntu), this is a Server issue.

Regards Kevin

dr-dimitru commented 1 year ago

@kmoyse-apizee userId should be available on the file's object/record

kmoyse-apizee commented 1 year ago

Hi @dr-dimitru , Yes you are right, userId is available on the fileRef object. With it I can get the user with: const user = Meteor.users.findOne(fileRef.userId) but, would it be more Meteor style to get it from context (this.user()) ?

dr-dimitru commented 1 year ago

would it be more Meteor style

this package has its own api with long history

Feel free to close it in case if the issue is solved on your end.