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

    I’m trying to create a file download, I figure I could do this via a Static Resource and add the file and choose Attachment type, but it just downloads the .html page. I’m trying to allow a download of a zip archive. I also tried adding a mime/content type for zip but just seemed to break the URL(loaded a 404 not found).

    Would I have to make a redirect to the file on my server? Or am I missing something for the Static Resource?

    Thanks!
      • 36404
      • 307 Posts
      hi,

      i must say i do not exactly understand where the problem is... set a download on a file is just linking to it ! particularly with zip/rar files (with an image, if you don’t want your users to open the image in the browser, you would have to write some php or js)

      then if you download link is located inside some text, just link to it using the RT editor file manager, if it’s standing alone, you can do that with a TV or two (the second one if you want a link text different from the filename

      Have swing
        réfléchir avant d'agir
        • 10395
        • 96 Posts
        What is the point of the "Attachment" option then? Or the Static Resource option? I’ve read users having PDF files downloaded using the Static Resource option, so don’t see why I can’t do it with a zip?
          • 20308
          • 31 Posts
          Hi
          Static resources could be usefull if you want to locate your files outside of the webroot. Then you can assign user/group permissions to the static resource to allow which user/group can download the file, etc...
            • 10395
            • 96 Posts
            Well, that’s what I’m trying to do, but it won’t take a zip file. I assume it shouldn’t just take .html? Perhaps I’m just not understanding. I would assume an "attachment" type would....well, attach any kind of file?
              • 3749
              • 24,544 Posts
              Have you tried this:

              <a href="URL_of_file">Download file x</a>


              You might not need a static resource unless you want to either schedule publication, or control access via resource groups.

              That said, try setting:

              Content Type: .zip
              Content Disposition to inline, or attachment (try both)
              Uses Template to "none."
                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