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

    Thank you for taking the time to post such a detailed solution

    This would be perfect - The only problem being is there is going to be a lot of files and my client doesn't want to have to link each file to a static resource which I can kind of understand. Its a shame because if they were static resources I would be able to send email notifications to users when things changed which would be ideal.

    What the client wants to be able to do is just dump a load of files to the server and list them. I was using filelister as a solution but the trouble was the file sizes my client was adding were huge and there were memory issues.

    I think I am going round in circles!

      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Well, you can use .htaccess rules to prevent any HTTP access to directories within the web root, but then you have to have some method of linking to and streaming the files internally. I believe that there are file-serving extras that can do this. I don't know if they can handle files in directories outside of the web root.
        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
        • 24676
        • 60 Posts
        yeah sure - thank you for your help though. I will let you know what I end up going with!
          • 4172
          • 5,888 Posts
          you could create a simple CMP (for example with help of MIGXdb) to manage the static resources and let the static resources be created automatically (by pressing a button above the grid for example)
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 24676
            • 60 Posts
            ok wow - this sounds interesting. Are you able to give me anymore information on how I would create a static resource on clicking a button?

              • 28042 ☆ A M B ☆
              • 24,524 Posts
              You would need to write a script to scan a given path and generate static resources with all the appropriate settings for every file with a given suffix. So the user could upload a bunch of files in a directory (probably via FTP/SFTP), then in the CMP go to that directory and select it, and click a "create" button to run the script. It might also need to create a new "container" resource to match a new directory.
                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
                • 41592 ☆ A M B ☆
                • 83 Posts
                he could make a custom event to run when file are uploading in order to run this script automatically
                  Francesco Mussoni | MODX Ambassador | Skype: solidusite2 | Email: [email protected]
                  • 28042 ☆ A M B ☆
                  • 24,524 Posts
                  If files are uploaded via FTP/SFTP there's no event to run. And with the large files that have been mentioned, that's the only way these are going to get uploaded.
                    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
                    • 41592 ☆ A M B ☆
                    • 83 Posts
                    mm you're right. and what about a crono-job? something that check if changes is applied (like every hour) and eventually run script? too much expansive? I'm looking for a solution that's "client-side"
                      Francesco Mussoni | MODX Ambassador | Skype: solidusite2 | Email: [email protected]
                      • 28042 ☆ A M B ☆
                      • 24,524 Posts
                      There is a cron manager add-on around somewhere. Don't know how it works, though. And MODx can be instantiated and the API used in external scripts. It's a matter of getting the new files represented in the database by new entries in the site_content table, with the class_key of modStaticResource, and the rest of the appropriate settings. Getting them added to the resource group as well. But it could be done.

                      http://rtfm.modx.com/revolution/2.x/developing-in-modx/other-development-resources/loading-modx-externally

                      http://rtfm.modx.com/extras/revo/cronmanager
                        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