We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30269
    • 119 Posts
    Got an issue with the counter. For small files, <100K, the download counts adds up 1 nicely. But, if the file gets larger, it adds up more. For example, every time I download a file of 800KB, it adds up 6 or more to the counter... any idea why downloading one file get hit multiple times huh
      • 23050
      • 1,842 Posts
      Thx Kyle for your work ! I’ve just updated 2.5 to 2.6.
      But the issue about desc file with fd plugin is still there. I can’t get the desc displayed.

      Look at my first post here : http://modxcms.com/forums/index.php/topic,5419.msg111460.html#msg111460
        • 25483
        • 741 Posts
        Is it possible to use FileDownload multiple times on 1 page?

        I need that because I have a page that needs to list more folders with a text above every folder. The documentation does not say anything about a ID or something like that sad
          with regards,

          Ronald Lokers
          'Front-end developer' @ h2o Media

          • 22388
          • 100 Posts
          Its a really good thing!
          But I would like from it any small things: that it correctly output links to files and directories with cyrillic symbols, and also correctly output links with symbols "’" and "&" in names of files and directories !

          I have tried to make the first so:
          if(strlen($this->_config['curRelPath'])) {
          						$filelocat = implode("/", array_map("rawurlencode", explode("/",  $this->_config['curRelPath']))) . '/' . rawurlencode($filename);
          					} else {
          						$filelocat = rawurlencode($filename);
          					}

          And it even works!
          But I don’t know how to realize the second! embarrassed
          It would be desirable, if the author will consider it in the next version of filedownload, or If somebody will prompt me, how can I make it for myself?
            Sorry for my english! smiley
            • 28033
            • 925 Posts
            Just wanted to give a big thanks for this snippet. In normal use, I use it for showing the uploads my site members have added (before I move them to their respective sections), but I found another great use for it.

            http://symphonicheaven.com/ps2/symphonia/downloads/icons.php

            Because it has the templating capabilities, I was able to create a custom template to show off the icons users can use. And if the person makes more of them, all I have to do is upload them to a folder on the server, and FileDownload automatically adds them for me. I’m planning on also using this to show off audio and video in the future. With the amount of work I have to do on the backend of the website, having the ability to automate stuff like this is a godsend.

            *thumbs up to creating this script* ^.^

            Quote from: ronaldlokers at Sep 18, 2007, 06:00 AM

            Is it possible to use FileDownload multiple times on 1 page?

            I need that because I have a page that needs to list more folders with a text above every folder. The documentation does not say anything about a ID or something like that sad

            Yep. That link I gave above calls FileDownload three different times.
              My Snippets
              -> PopUpChunk v1.0
              • 15734
              • 70 Posts
              Hi, I’m new to this and have been trying to figure out what I’ve done wrong but I can’t get this working at all. I’m using Modx 9.6, FIledownload Snippet 2.6 and FiledownloadPlugin 1.2. I’ve set the TV to "downloads/bylaws" and am trying the simplest snippet call [!FileDownload?!]. I’ve check and re-checked spelling, etc. Permissions of directory are 766. page returns:

              « MODx Parse Error »
              MODx encountered the following error while attempting to parse the requested resource:
              « PHP Parse Error »
               
              PHP error debug
                Error: 	is_dir(): Stat failed for downloads/bylaws (errno=13 - Permission denied)	 
                Error type/ Nr.: 	Warning - 2	 
                File: 	/var/www/vhosts/kevincunningham.ca/httpdocs/idns/assets/snippets/filedownload/filedownload.class.inc.php	 
                Line: 	376	 
                Line 376 source: 	if (is_dir($path)) { 	 
               
              Parser timing
                MySQL: 	0.3645 s	(7 Requests)
                PHP: 	0.0853 s	 
                Total: 	0.4498 s


              Any ideas what I’m doing wrong?
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                In the first place, you don’t need the ? in the snippet call unless there are following &parameters.

                As far as the error goes, it apparently does not like the 766 permissions. Have you tried 755 and 777?

                Also check your phpinfo listing to see if you have some kind of safe_mode file system access restrictions set in php.ini.
                  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
                  • 15734
                  • 70 Posts
                  Thanks. The 766 was the problem. Not sure why I didn’t try that. Now I just have to get it looking the way I want it. Thanks again!
                    • 28042 ☆ A M B ☆
                    • 24,524 Posts
                    Numeric (octal) file permissions:
                    1 --x execute
                    2 -w- write
                    3 -wx write and execute
                    4 r-- read
                    5 r-x read and execute
                    6 rw- read and write
                    7 rwx read, write and execute
                    Therefore, 766 means "owner - read, write, execute", "group - read, write", "other - read, write". For a folder, execute is required in order to "open" the folder to gain access to its contents. Since your PHP is being run as an Apache module, the "other" user must have execute permissions. Thus 755, or 777. 755 is a bit more secure if you don’t need to have PHP write to the folder.

                    644 is usually quite good enough for most of the files in the MODx folders, since the owner can read and write (thus being able to update or delete the files via FTP), while the Apache user only needs to read them. Setting the config.inc.php file to 444 makes it very difficult to accidentally delete or change it, since you must first change its permissions to allow anyone to change or delete it.

                    Since the MODx PHP files are run through an interpreter (whether as an Apache module or a stand-alone CGI module), they do not need execute permissions, only read permissions so the interpreter can read them. If the file is written to be run from the command line directly (with the first line " #!/usr/local/bin/php"), it must have execute permissions in order to run.

                    Since usually PHP is an Apache module, a PHP script runs as the Apache server user, which would be the "other". That is why folders like the Cache folder have to be 777 on most of these systems, so that this Apache user (not the file’s owner, who is whoever put the file in place, usually your FTP user) can not only open the folder (execute) but also write to it to write the cache files.

                      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
                      • 15734
                      • 70 Posts
                      Thanks Susan,

                      A very clear explanation. Makes perfect sense. I’m new to this and know just enough to be dangerous.

                      I hate to impose again but I’m having a bit of difficulty with getting this to look the way I want it. It’s very basic. I just want an icon with the file name beside it as a link.

                      My snippit call looks like this:

                      [!FileDownload? &tplList=`fdTemplate` &imgLocat=`assets/images/filetypes` &imgTypes=`fdImages`!]


                      fdTempate chunk:

                      <img src="[+fd.image+]"/><a href="[+fd.link+]">[+fd.filename+]</a>


                      fdImages chunk:

                      doc=doc.png,
                      pdf=pdf.png


                      This is the resulting html:

                      <pre><img src=""/><a href=""></a></pre>


                      If i change the snippit call back to:

                      [!FileDownLoad!]


                      I do have a folder with the appropriate I get what must be the default output. Any insight would be appreciated. I’ve tried to get this going all day. Am I just totally confused by the templating process? Thanks in advance.