We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 5798
    • 22 Posts
    Great plugin!

    I’ve placed my big files outside the html-folder, pointed the FileDownloadFolder TV to "../outside" and the files are still accessible with the FileDownload snippet!

    CONCLUSION: Now I can make one-click backups in confixx of my complete html dir without bloating the backup archives with the big files in the download folders! grin

    Very nice work!

    An idea: Since the plugin has full control over the actual path to the files, would it be difficult to integrate a captcha check for the downloads?
    See: http://modxcms.com/forums/index.php/topic,13204.0.html

    That would be fantastic!

    Greetings,
    CoreBit



      • 27751
      • 45 Posts
      Main Page for this plugin is missing an example of use. It attempts to tell how to use it, but an example of the code I would actually insert into the page would be helpful.

      I am jumping back into MODx after being a way for a while so I am really brand new since MODx and CMS in general are still very new to me.

      I rely on examples of Plugins and Snippets in order to use them. The syntax is all still unfamiliar to me, so this makes it easy for a beginner like me.
        Dedicated CENTOS 5.5 x86_64 standard WHM 11.28.64
        Apache/2.2.17 | PHP/5.2.15
        MySQL Version 5.0.91 | MODx Revolution
        • 6298
        • 13 Posts
        Quote from: CoreBit at Mar 20, 2007, 08:42 AM



        ......pointed the FileDownloadFolder TV to "../outside"



        How did you do this?

        Did you use.... "@DIRECTORY path_to_folder_"?

        Thanks.
          • 6298
          • 13 Posts
          Ignore last post, fixed it & it is working a treat!

          Ono, thanks for great script!

          smileybri....follow these instructions, it works, easy when you know how [I’ve edited/added comments which I hope might help!]...

          Sorry if this is a very basic for advanced users...just ignore this post!

          1) Create new TV called "FileDownloadFolder" in the MODx Manager. Make sure you tick the box to allow access from the template you are using. Leave everything else blank.

          2) Create a new new plugin called "FileDownloadPlugin".

          3) Copy and paste "FileDownloadPlugin1.0.php" content from attached zip file
          without 1st line "<?php" and last line "?>" into "Plugin code" editbox.

          3) Before saving, click on the System Events & tick box for "OnWebPagePrerender" under the Template Service Events section.

          4) Press "Save".

          5) Create new document called "downloads" if the template that controls this document has access to the TV "FileDownloadFolder" you will see a box you can enter the path to your download folder. For *nix it is the full path on the server...e.g:
          /var/www/vhosts/yourdomain.com/httpdocs/assets/files/privatedirectory/

          6) On the page that requires a user login, create a link to the file to be downloaded. e.g.

          <a href="http://www.yourdomain.com/index?q=downloads&d=filename.pdf" target="_blank">VIEW</a>

          Where "filename.pdf" is the file to be downloaded.

          7) Once you have confirmed all is working OK, only then try turning on friendly URLS.

          8) I used the default MODX entry for url rewriting in my .htaccess file:

          RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

          9) Login as user & test & then logout & test if file can still be accessed at the same utl:

          http://www.yourdomain.com/index?q=downloads&d=filename.pdf

          10) When user is logged in, if a blank template page is shown after clicking on the url to your file, check that path to your private download folder is correct (see 5, above).

          Thanks everybody for all the helpful posts!
            • 6726
            • 7,075 Posts
            Quote from: OpenGeek at Jan 10, 2007, 07:22 PM


            Change lines 340-344 of filedownload.class.inc.php:
            //					if ($this->_config['urlsetting'] == '?') {
            //						$fileLink = $this->_config['curUrl'].'/'.$filelocat . $multiFolderLink;
            //					} else {
            						$fileLink = $this->_config['curUrl'].'&d='.$filelocat . $multiFolderLink;
            //					}


            The variation with the / only works if you change your .htaccess as described in the FileDownloadPlugin instructions.

            I know I am late to the party but I was stuck with the clean URL problem and this saved my day, you’re da man Jaze grin !
              .: COO - Commerce Guys - Community Driven Innovation :.


              MODx est l&#39;outil id
              • 4499
              • 34 Posts
              Host Configuration

              IIS 6 (Windows Server 2003 SP2)
              PHP 5.2.0 (via ISAPI) + MySQL 5.0.22

              I am attempting to install this on MODx 0.9.6

              I had the FileDownload Snippet working correctly, and was able to download documents with the standard call.
              I Installed this plug in and the FileDownload snippet now see’s the directory assets/files/Staff perfectly from the TV, but it cannot download anything.

              I click on the links and they just refresh the page. The link itself points to - index.php?id=139&d=logo.doc
              If I right click and save as - it then saves a html version of the current page.
              The download count does not update either.

              URL Rewriting is not installed.
                • 5261
                • 7 Posts
                Installation:

                1) Create new TV called "FileDownloadFolder" in the MODx Manager
                2) Open creation of new plugin called "FileDownloadPlugin"
                3) Copy and paste "FileDownloadPlugin1.0.php" content from attached zip file
                without 1st line "<?php" and last line "?>" into "Plugin code" editbox
                3) Bind the plugin to OnWebPagePrerender event
                4) Press "Save"
                  • 4499
                  • 34 Posts
                  It was bound - turns out somehow it picked up the <?php & ?> again.

                  Either that or I deleted those from one of the other modules I am still try to implement.
                    • 13736
                    • 345 Posts
                    Ok. After reading through four pages of thread. Is it not possible to use this plugin with friendly urls? I’ve been trying to get it working for hours with no luck. I can’t really use a flat url system on this particular site.

                    So what are my options to get some sort of file download system going? Currently I just get a blank page where the downloads should be. Am I supposed to insert the TV into my template (currently doing) or content box or does the plugin take care of that somehow?

                      • 11190
                      • 109 Posts
                      Hello, all. This plugin has worked very well for us until we used it for a site with several large video files. We now see that the plugin locks the web site until the download is complete. This has two highly undesirable effects:

                      1) The site cannot be navigated while a download is in progress. No page, not the smallest, simplest text page loads while a download is in process.

                      2) Users cannot concurrently download more than one file at a time. I frequently use DownThemAll! with Firefox. It tries to start multiple downloads but only one progresses. Since the others must wait to begin, they eventually time out and fail.

                      We’re deeply appreciative of the plugin but this is rendering out latest site, http://www.spiritualoutreach.com almost unusable. I’ve read every post to this thread and the documentation. Did I miss something in the configuration? Is there any way to fix this quickly as it is now a critical need for us? I’m afraid I am completely ignorant of PHP and how to fix this myself.

                      We’re using version 1.2 with this configuration:
                      &countDownloads=Count Downloads;list;yes,no;yes
                      &useDbCount=Store Count Where;list;db,file;db

                      HELP? (Now I feel better - thanks) - John
                        http://www.spiritualoutreach.com
                        Making Christianity intelligible to secular society