We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 5628
    • 44 Posts
    Hi
    Working on an image management module for Mod-X to use on a site [1].
    New territory but thanks to sottwell tutorial [2] and files getting someway into it.
    Was wondering if there were any hints and tips out there on how to add a file uploader into a module a la that available through TVs.
    Am guessing could use the Mod-X API and bindings but this is all still quite new to me embarrassed
    Answers on a postcard gratefully received...

    Cole


    [1] see http://modxcms.com/forums/index.php/topic,21848.0.html for previous discussion on this topic
    [2] http://www.sottwell.com/database-module.html
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      In the third article in that module tutorial series, I have a file upload feature (for uploading a csv file to insert into the database) but it would work for any file upload. Because I wanted this to be part of a mostly AJAX-driven manager page with several options, I put it in an iframe.
        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
        • 5628
        • 44 Posts
        Hi Susan
        Invaluable resource many thanks - can’t believe there isn’t more out there on writing modules for MODx.
        One issue I have with using Ajax in your examples is that the referenced files used to populate the page are situated and accessed outwith the MODx manager (on the client side), meaning

        • they can be accessed directly, not a good idea for a management interface, and
        • you cannot access the modx api from within them
        Are these points right or am I missing something?

        Cole
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          No, you’re right. I’m still learning Ajax; I’m sure that there are ways to make those scripts more secure.
            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