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

    On one website under Revo, I have a member access.
    Inside this private area, I need to link files for downloading.
    But I want to secure this download : if you are not login on the website, I want to make this download link forbidden (and why not with an information about "you need to be authentificated to download this file").

    How can I do this ?

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

    • discuss.answer
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Depending on how many files you have, you can use Static Resources to link to the files. If necessary, create a custom Content Type for it. Then simply protect the static resources like any other protected resource.

      This method has the advantage that you can have the files stored outside of the web root, and the URL to the file is the URL to the resource, not to the file itself.

        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
        • 28173
        • 409 Posts
        Thanks for the tip, I think it will do the job smiley
        And if I have a large collection of files, what should be the solution ?
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          There are several extras for handling file downloads. Two come to mind right away

          http://rtfm.modx.com/extras/revo/filelister
          http://rtfm.modx.com/extras/revo/filedownload-r
            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
            • 28173
            • 409 Posts
            Thanks smiley
              • 28173
              • 409 Posts
              Quote from: sottwell at Feb 28, 2015, 12:17 PM
              Depending on how many files you have, you can use Static Resources to link to the files. If necessary, create a custom Content Type for it. Then simply protect the static resources like any other protected resource.

              This method has the advantage that you can have the files stored outside of the web root, and the URL to the file is the URL to the resource, not to the file itself.

              Hi !

              I just come back on this problem.
              I have some diffitulties to implement the Static Resources solution.
              I set up a new Media Source called "Private files"
              The directory used for it, is outside of the web directory as you suggest me.
              When editing the static resource, I could choose the new media source and select the right file.
              But on front end, the download link is http://www.domain.tld/my-file.pdf and when I click on it, I have an error 404 (the download is not starting).

              Maybe I do something wrong on the configuration of my media source (sorry for the french) :


              Here there is the chunk code for the getresource call :
              <li><a href="[[+content]]">[[+pagetitle]]</a></li>


              What's going wrong ?
              • discuss.answer
                • 4172
                • 5,888 Posts
                what you are looking for, is

                <li><a href="[[~[[+id]]]]">[[+pagetitle]]</a></li>


                  -------------------------------

                  you can buy me a beer, if you like MIGX

                  http://webcmsolutions.de/migx.html

                  Thanks!
                  • 28173
                  • 409 Posts
                  Arf.... you're right !
                  Thanks you smiley