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

    Currently, I’m manually editing the HTML on the page when we want to make a PDF file available. What I would like is to be able to have a page that has uses ditto call to show all the published files beneath it. This would give me much better control and convenience and allow me to get extra sleep when a file needs to be made available at 6:00 AM, for example.

    My thought is to create a template variable called "fileattachment", with input type as "File". Then create a new page that will be "application/PDF" and Content-Disposition of "Attachment".

    Then when someone clicks on the page link, they will get the associated PDF file.

    I’ve tried the steps above, but when I click the link, I get a 0-byte pdf, so close yet so far.

    Anyone know what I’m doing wrong or better yet, how I can make this work?

    Thanks.
    huh
      • 3749
      • 24,544 Posts
      Make sure the "page" with the file has a blank template

      Is there some reason you just don’t want to put link to some or all of the files on a regular page?

      If you have all the pdf files in a single directory, the easiest thing for you would be a really simple snippet that reads that directory and displays links to them. As long as the files are descriptively named, you’d never have to do anything.

      I have a pdf newsletter page set up that way and a user that uploads the pdf files (using the FileUpload snippet). The snippet sorts the files by year and month before displaying them. I never have to touch it.
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting