vsivsi / meteor-file-collection

Extends Meteor Collections to handle file data using MongoDB gridFS.
http://atmospherejs.com/vsivsi/file-collection
Other
159 stars 37 forks source link

Uploading file data to empty file document #144

Closed Chey47 closed 7 years ago

Chey47 commented 7 years ago

Hey i cant seem to understand how this package works :( please can you help ?

so i do this :

 var id = userPicture.insert({
                filename: file.name,
                contentType: file.type,
                metadata: { owner: Meteor.userId() },
            }, function(){
                    console.log(id);
            });

All is fine i get my file in my collection with the md5 and _id and metadata.owner but when i call : /gridfs/userPicture/{{md5}} i have a blank page with a lot of js errors !

I allowed everyone to add/write/show/delete files to test.

:( what am i missing ?

P.S : all my files seem to have the same md5...

vsivsi commented 7 years ago

Looks like you need to somehow actually upload the file data!

I'm sure you can appreciate that an issue thread isn't the place for a tutorial.

I recommend studying the code of the sample apps (they actually work!) to understand how to best use this package:

Simple: https://github.com/vsivsi/meteor-file-sample-app More complex: https://github.com/vsivsi/meteor-file-job-sample-app

Chey47 commented 7 years ago

Well thank you my friend i figure it out now :) great great package ! but one last question if possible : can you use this package without the resumable thing ? if yes , a little hint on how please if possible of course...

Thank you :)

vsivsi commented 7 years ago

Hi, using resumable.js is optional. You can simply disable it (or rather, not enable it).

You can load data into the fileCollection on the server-side using a node.js stream, or you can upload from a client using an old-fashioned form-based upload via MIME multipart/form-data encoded HTTP POST request, or even a bare HTTP PUT request.

All of the above functionality is built-in. Beyond that, it is possible to register your own request handlers to upload in any other way you would like...

Best.

Chey47 commented 7 years ago

thats so nice of you :) i get it now ... thank you for your conciderable time.