Upload Media Using Meteor-Files
Learn how to upload media files in a MeteorJS application.
We'll cover the following...
Meteor-Files
Meteor-Files is a third-party Meteor package that’s very efficient at uploading files for storage. It can store files on the server’s file system and in third-party storage like Amazon S3, Dropbox, GridFS, and so on. It’s compatible with most front-end frameworks used by Meteor. It supports resumable downloads and also provides functional hooks, which we can utilize to perform custom logic as a file is uploaded. Hooks such as onAfterUpload
and onBeforeUpload
can be used to perform custom logic on uploaded files.
Meteor-Files is installed on our project by running the following command on the terminal:
meteor add ostrio:files
Meteor-Files saves the path of the uploaded file in MongoDB. We can retrieve uploaded files using the same Meteor MongoDB API as find
to pull documents out of collections
.
The playground below demonstrates how to upload files using Meteor-Files.