How to handle file uploads?


#1

I just realized I have no idea how to allow a user to upload a file to my SaaS. I don’t see anything mentioned in the Meteor documentation, so I assume it doesn’t support it. Any recommended packages?

I’m not sure if I want to store files on my VPS, or on Amazon S3. Users will be uploading product images, and a handful of PDF files. I’m open to suggestions. I’ll probably be using Modulus to host, eventually.


#2

If it’s just images (and non commercial in nature), I think imgur might be good. There’s a paid API that’s more or less about $24 a month? But you said product images, so I don’t know… you might need to host it with your own VPS or something. CollectionFS package?


#3

This package lets you upload files, and does pretty advanced stuff like progress, multiple files and much more.


#4

You can also have a look as meteor-slingshot as it allows for several SaaS platforms as well as your own servers.


#5

Thanks, those are both great options! I’ll check them out.


#6

Also consider the CollectionFS group of packages: it s a rather complex solution, but works well for me.

You can upload to multiple backends, like cloud storage, to your MongoDB (gridfs) or to the filesystem.


#7

you are most welcome


#8

does anyone have a simple example of using the meteor collection fs package? I just want to upload documents, store then in a folder on the server, then store the location of the file into my mongo collection so I can provide a download option for the file when the particular document is being displayed…

or should I be looking at


?? it seems pretty full featured.

OR, is there a possibility of storing the uploaded document directly into the mongo collection? I’m new to meteor and mongo so not sure of best practices yet in this area… with my previous work with php and mysql, typically you could choose between storing on the file system directly or storing as a binary field in the mysql db…


#9

Yeah I tried collection fs package, started getting errors with it and could not fix it. I switched to this jquery package you linked to. It works great for me. Very simple to setup and I was up and running pretty quickly and no problem since. The only negative I have seen is that is it not seamless to integrate into autoform (which i use). I am a noob in meteor so maybe I am missing something. But yeah its is great


#10

Does anyone know what the most common practice (storage option) for storing user profile images? My use case would only require a single photo per user.