We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 13003
    • 18 Posts
    I’ve been playing with the FileDownload resources that I’ve found, they work fine, but they link *directly* to the target file.
    The catch is, I want to be able to store files out of public_html, and redirect downloads through PHP.

    I’ve done this in the past using straight PHP scripts, but is there any way I can do this using Plugins? I was thinking that I should create a plugin that listens on page load, for a certain URL structure, but the Docs that I’ve found aren’t too thorough, so I’m uncertain which on-load event I should check, and I’m also uncertain as to what system variables are available to me.

    #1. is what I’ve just discussed, possible as a plugin or some other type of resource within ModX? (I would be using a function such as readfile, and output mime type as needed, etc)
    #2. can anyone point me to better documentation, if it exists? the documentation I’ve found on modxcms.com seems to be a bit lite.

    Thanks
      • 3763
      • 155 Posts
      Yep, that would be a nice feature to have. I am also looking for some download thing that will let me hide the files out from public_html.
        ...my Photo Gallery on Flickr...
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        The old "docman" snippet/application that I did can do that, it stores the file metadata in the database and stores the file itself in the filesystem named "insertID.dat" where insertID is the insert id for the metadata. You can store the physical files anywhere your php has permission to access. The physical location for the file is part of the metadata.

        Feel free to rip out whatever you want.

        http://modxcms.com/forums/index.php/topic,383.msg6288.html#msg6288
          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
          • 13003
          • 18 Posts
          Thanks, I appreciate it wink
            • 7923
            • 4,213 Posts
            If you use &downloadCount=`1` in FileDownload, the path to the file is base64 encoded.


              "He can have a lollipop any time he wants to. That's what it means to be a programmer."
              • 32847
              • 171 Posts
              The path will be encoded but files will be still in the public area and I suppose he doesn’t want such a solution undecided
                • 7923
                • 4,213 Posts
                I’m not following, the files will need to be in the area where php has access to, that all.


                  "He can have a lollipop any time he wants to. That's what it means to be a programmer."
                  • 13003
                  • 18 Posts
                  Quote from: doze at Sep 09, 2006, 01:24 PM

                  If you use &downloadCount=`1` in FileDownload, the path to the file is base64 encoded.

                  that was perfect, thanks. smiley