We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 32507
    • 142 Posts
    Hi,

    I have file download section for my Customers (webusers). Files are located in directory under 'assets/'.

    I can use static resources, but in this case i would rather use fileDownloadR -plugin. Filesizes are too big for hashed links, so i have to use directlink- option. In this case paths to my files is exposed to everybody.

    How can i restrict this directory for signed-in webusers only?

    This question has been answered by multiple community members. See the first response.

    • discuss.answer
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      You can't. Anyone who knows the URL to the files can access them as long as they are in the web space.

      If you store the files in a directory outside of the web root, then the only way the files can be accessed is via your filedownloadr snippet.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 32507
        • 142 Posts
        Ok. Thank you.

        I guess i can't store files outside webroot, since i have to use directLink. It reveals absolute server path sad
        • discuss.answer
          • 4172
          • 5,888 Posts
          if it needs to be direct links to the files you can't protect them to specific MODX-users
          If you want them to be protected, you will need to protect the directory for example on apache with a 'deny from all' in .htaccess, if you can't put them outside the web-root.
          Then you will have access only by php.

          for example by static resources or filedownloadr

          Why do you have to use directLink? Can you explain?
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 32507
            • 142 Posts
            Hi,

            I ended up using FD custom links to static resources. I protected files itself with htaccess.

            File sizes are too big to handle with FileDownloadR hashed links. I'm don't fully understand why, but what i understand server php memory limit should be at least same as file size. All files which are bigger than memory limit will be truncated.

            https://github.com/goldsky/FileDownload-R/issues/1