Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You could <a href="https://stackoverflow.com/questions/8515410/store-files-on-disk-or-mongodb">try storing the files in mongodb</a>, which would mean that they would then be hooked into your collection system and be queryable on the client and server. Then, just publish the relevant data to the client for specific users, or use Meteor.methods to expose information that way.</p> <p><strong>Example:</strong></p> <p>Assuming files are stored in MongoDB, let's first publish them to the client:</p> <pre class="lang-js prettyprint-override"><code>Meteor.publish("files", function(folder) { if (!this.userId) return; // the userHasAccessToFolder method checks whether // this user is allowed to see files in this folder if (userHasAccessToFolder(this.userId, folder)) // if so, return the files for that folder // (filter the results however you need to) return Files.find({folder: folder}); }); </code></pre> <p>Then on the client, we autosubscribe to the published channel so that whenever it changes, it gets refreshed:</p> <pre class="lang-js prettyprint-override"><code>Meteor.startup(function() { Meteor.autosubscribe(function() { // send the current folder to the server, // which will return the files in the folder // only if the current user is allowed to see it Meteor.subscribe("files", Session.get("currentFolder")); }); }); </code></pre> <p>NB. I haven't tested above code so consider it pseudocode, but it should point you in the general direction for solving this problem. The hard part is storing the files in mongodb!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload