We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 9207 ☆ A M B ☆
    • 2,475 Posts
    Nope, I don’t think that’s it at all: I think most browsers these days are able to display a PDF inline, even if it’s marked as an attachment. If you had one browser without a PDF plugin (if you can find one), my guess is that clicking the same link would force a download in that browser.

    Glad you got it working.
      • 34072
      • 31 Posts
      Ah, that makes sense.

      Do you know if there’s any easy way to change all my Static Resources’ content disposition to "Attachment" or will I have to change each one manually?

      Thanks, Kahli
        • 9207 ☆ A M B ☆
        • 2,475 Posts
        You could update the database directly (please make a backup before you try it). It’s the modx_site_content table, there’s a column "content_dispo". It looks like you have to set that to 1 for an attachment. You’d just have to carefully construct your WHERE statement so you modified only the static resources you need to update, e.g.

        UPDATE modx_site_content SET content_dispo=1 WHERE contentType='application/pdf' AND class_key='modStaticResource';


        This isn’t the best way to do it, but I’m not aware of a GUI tool that will do that for you.
          • 20291
          • 3 Posts

          My guess is somehow "Inline" and "Attachment" have been switched around so that setting the content disposition as "Inline" makes it open as an attachment and vice versa. Is there something I can do to change it so they behave as they should? I have over 100 PDFs set up this way on my site and I’d rather not have to go in to each one individually and change the content disposition.

          Thank you so much,
          Kahli

          Hi, i can absolutely confirm this. i got pdf-downloads as attachment with static recources to work in 2.0.4. Content-Type: PDF, Content-Disposition: Attachment (PDF as application/pdf, binary checked).
          my site was hacked 2 weeks ago (code injection on all index-files), so i upgraded to 2.0.7 undecided

          after this upgrade i had to uncheck "binary", since large PDF-files resulted in a server-timeout when clicking those downloads. so i switched back to binary, but then all my static recources with pdf-downloads are opened in the browser instead of downloaded and i don’t want to change all 600 as a bugfix.

          sincerely
            • 22303 MODX Staff
            • 10,725 Posts
            I can confirm that the behavior of Inline and Attachment is now backwards in 2.0.7. Here is the official fix until this gets merged into the main repository. Also, for reference, this is bug-3693.
              • 9207 ☆ A M B ☆
              • 2,475 Posts
              I stand corrected. Bummer.
                • 34072
                • 31 Posts
                I’ve applied the fix and everything appears to be working perfectly. Thank you OpenGeek! Thank you also Everett and motuika for your help/contributions.
                  • 20291
                  • 3 Posts
                  Thanks a lot to all of you!! This was very helpful! I also got it fixed with the above fix (https://github.com/opengeek/revolution/commit/efd81d3d23abb2037c941c3b4f543397510d4b16).