We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 2912
    • 315 Posts
    Quote from: gracedman at Jul 10, 2008, 05:29 AM

    We had used the filedownload plugin/snippet for the book and video downloads on our www.spiritualoutreach.com web site. The counter worked perfectly fine and is one of the reasons we were disappointed to not be able to use the plugin because of blocking problems on very large downloads - something we were never able to fully resolve.

    It has been quite a while since we used it and I do not have our configuration on file but I do recall a problem where the template variable for the directory did not properly handle inheritance and had to be manually set on every page. I don’t think that affected the counter; I think that prevent the proper finding of files but you could try it. Sorry I can’t be of more help - John

    I know I pm’d you on the above but here is what I did to get around the website browsing block whilst downloading. I’ve had this change running since around the 10 July with no feedback from the user base.

    add the following line:
    $downloadFileURL = ($modx->config['site_url'].$downloadFolder . '/' . trim($_GET['d']));
    


    after this one:
    $downloadFile = realpath($downloadFolder . '/' . trim($_GET['d']));
    


    Add the following 2 lines
    header('Location:'.$downloadFileURL);
    exit; // CxH Added for Browsing purposes
    


    before
    if($fp = @fopen($downloadFile, "r"))
    


    It does break the ethos around the plugin as far as security on the file path goes but it does allow a user to continue browsing whilst the download is running.

    PS: I know it’s not the pretties change and it does make some of the code redundant. My biggest apologies to the creator of the plugin and Filedownload snippet.
      BBloke
      • 26482
      • 138 Posts
      I’ve downloaded FIleDownload 2.6 and it works nicely visually. However, the fd.link generates the wrong link. I’m calling the snippet on a protected page (login) and the following url is generated for my files:

      /url/login/assets/files/sub-dir/file1.pdf

      Obviously, this doesn’t work. Any idea as to how I should trick FIleDownload into giving me the right url?

      Thanks.
        • 24445
        • 1 Posts
        I hava this messsage :


        « MODx Parse Error »
        MODx encountered the following error while attempting to parse the requested resource:
        « PHP Parse Error »

        PHP error debug
        Error: include_once(data.db.class.inc.php) [function.include-once]: failed to open stream: No such file or directory
        Error type/ Nr.: Warning - 2
        File: C:\Program Files\EasyPHP 2.0b1\www\manager\includes\document.parser.class.inc.php(769) : eval()’d code
        Line: 11

        Parser timing
        MySQL: 0.0059 s (3 Requests)
        PHP: 0.0513 s
        Total: 0.0572 s



        I don’t understand, pleas help me, thanks
          • 1978
          • 131 Posts
          So what about captcha to download file? google and MODx searches didn’t return any worthy results and reading 13 pages is too hard
            Как русифировать Modx 0.9.6.1(QuickEdit, TinyMCE)
            QuickEdit под win-1251 без mb_-функций
            • 29525
            • 388 Posts

            I can’t seem to get the file download to work. The snippet displays all the files correctly on my page, but the links simply open the files in the browser. I’m not using the plugin--yet. I thought I should get this working first before add that to the mix.

            Am I misunderstanding what this does? Does it simply list the files with links? Does it require the plugin to force the download dialoge box?

            I’m calling the snippet from a chunck in the main content area (RTE turned off).

            [!FileDownload? &getFolder=`assets/files` &tplList=`filedownloadtpl`!]


            I’ve modified the tpl to display only the filename, but otherwise I haven’t changed anything else.

            The html output produces a link just like any other link for each files in the directory.

            <tr class="fd-file fd-alt">
            	<td><a href="assets/files/content-brief-example.pdf">content-brief-example.pdf</a> <span style="font-size:80%"></td>
            	</tr>
            


            I’ve read through the 13 pages in the support thread at least 13 times. laugh

            What am I missing?
              www.terrybarthdesign.com
              • 22303 MODX Staff
              • 10,725 Posts
              Your browser automatically opens PDF files because of the file type. Is this what you are talking about? This has nothing to do with the snippet, but with the mime-types served in the headers for various file types like this using your browser preferences with how to deal with those files.

              I believe if you want to hide the actual path and have MODx control the headers, you would need to use something like the FileDownloadPlugin, but it would not solve this issue either without some customization on your part; it would have to provide a header to force the download vs. loading the file (i.e. change the mime-type based on file extension or similar).
                • 29525
                • 388 Posts

                If I understand you correctly, then, this snippet will not force the download, just present the files in the folder?

                The plugin is required to force the download dialogue box?

                  www.terrybarthdesign.com
                  • 7231
                  • 4,205 Posts
                  Quote from: Terry at Dec 21, 2008, 03:56 PM


                  If I understand you correctly, then, this snippet will not force the download, just present the files in the folder?

                  The plugin is required to force the download dialogue box?
                  From what I understand that is correct.
                    [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

                    Something is happening here, but you don&#39;t know what it is.
                    Do you, Mr. Jones? - [bob dylan]
                    • 22303 MODX Staff
                    • 10,725 Posts
                    Quote from: Terry at Dec 21, 2008, 03:56 PM

                    If I understand you correctly, then, this snippet will not force the download, just present the files in the folder?

                    The plugin is required to force the download dialogue box?
                    No you don’t understand correctly. The snippet presents a link for you to download the file with your browser directly from the web server. This interaction is controlled by MIME types and your browser says, "look, it’s a PDF file" and then decides to open the file directly in your PDF viewer application after silently downloading the file to a temporary location. This is how all file downloads work in browsers.
                      • 31471
                      • 206 Posts
                      The snippet serves link to the file somehow ’plain’, downloadable in the background by any method (dl accelerators etc).
                      When the plugin is active, it serves the file in - as much as I remember - a safer mode disallowing to resolve the file path (keeping it in a TV), from byte to byte, and doing so it ’freezes’ the user’s browsing session for the time of the download.
                      One can copy-paste the file-serving codes from the FiledownloadPE snippet into this plugin to resolve the ’freezing’ effect.