0

I need to upload an avatar to my app. But I want the shortest path to achieve this. Just a file input and a regular upload to my server side. Then I would just save whether or not the user has an avatar on MongoDB, move it to the avatar folder with the same name of the user's id.

But everything I see over there is quite complicated. All of them use third-party packages. But I guess Meteor provide it's own way with a little more configuration, doesn't it?

How can I do this task?

Blakes Seven
  • 49,422
  • 14
  • 129
  • 135
Victor Ferreira
  • 6,151
  • 13
  • 64
  • 120
  • it's a bit hard to see what you mean by shortest path, because for most people that would mean just using the right package (probably collectionfs), in which case you can get this done with around 10 lines of code. Baring that, I suspect using the File API to get a dataurl (string) for your upload and then inserting that into a collection client side would be the shortest path. One way or another it seems to invite opinions more so than "right" answers. – Christian Fritz Jul 22 '15 at 03:31
  • possible duplicate of [How would one handle a file upload with Meteor?](http://stackoverflow.com/questions/10099202/how-would-one-handle-a-file-upload-with-meteor) - I do find the answers to this question fairly bad though. – Kyll Jul 22 '15 at 13:23

1 Answers1

0

I suggest using CollectionFS plugin for meteor (link: https://github.com/CollectionFS/Meteor-CollectionFS ) - the documentation is pretty straightforward and clear.

lukaszkups
  • 5,790
  • 9
  • 47
  • 85