We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24017
    • 88 Posts
    Hi,
    I’ve tried the solution in the topic http://modxcms.com/forums/index.php/topic,41530.msg249760.html#msg249760 that deals with downloading the images... I was wondering if there was a way to get it downloaded properly, instead of the image showing in a different window so we can download it manually ?
    Many thanks
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      As far as I know, this is a "feature" of the browser, and there’s not much you can do about it. The same thing often happens when offering .txt and other text-type files for download via a link; the browser will open the actual file instead of opening a download dialog box.
        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
        • 7923
        • 4,213 Posts
        at server end you can force the client to download the file using:
        <?php
        header("Content-Type: application/force-download");
        header("Content-Type: application/octet-stream");
        header("Content-Type: application/download");
        ?>
        


        So you could write a snippet that forces the image download for the client, but if you do so, make sure that the script cannot be exploited to download anything other than the gallery images.


          "He can have a lollipop any time he wants to. That's what it means to be a programmer."