We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 41825
    • 16 Posts
    Hello world!

    I created a few static resources in Revo 2.2.5 and linked them to PDF-files from a media source (basePath = assets/media/downloads/, basePathRelative = Yes, baseUrl = assets/media/downloads/, baseUrlRelative = Yes). I created a Content-Type for those PDF-files (MIME-Type application/pdf, Binary) and selected it in the static resources.

    However, when I attempt to access the static resource, I only get an empty (=zero bytes) PDF-document. I don't see any errors in the ModX error log.

    Has anyone any idea what's required and what to try to get this to work? Thanks in advance!

    Chris [ed. note: bequadrat last edited this post 11 years, 7 months ago.]
    • Did you set the resource's Content Disposition to be "attachment" rather than "inline"?
        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
        • 41825
        • 16 Posts
        Yes, I tried both settings, neither worked. I also tried setting different content types and different media sources (the default one too), still no luck and no reported error. The file returned is always 0 bytes long :-/
        • Hm. Sounds like you did everything right.

          Try it using the default Filesystem media source.
            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
            • 4172
            • 5,888 Posts
            what is the content of your not working static Resource and what is the path to your file?
              -------------------------------

              you can buy me a beer, if you like MIGX

              http://webcmsolutions.de/migx.html

              Thanks!
            • Turns out I was mistaken about needing to use the "attachment" content disposition.

                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
              • Static Resources are not aware of Media Sources currently.
                  • 41825
                  • 16 Posts
                  Ok, that explains it, although I really don't understand, why ModX introduces media sources as a whole new way to handle files and recommends not using the old properties for the filemanager-paths/URLs in the system settings, if another basic feature like static resources rely on the old method.

                  So as I'm forced to select a file from a media source for a static resource from within the manager, I selected the default "file system" media source (which points to the root of my ModX installation, just like the filemanager system settings) and then the file. Still no luck, still only get 0-bytes-sized files and no error messages...

                  referenced file for static resource:
                  assets/media/downloads/12.pdf

                  URL for static resource used for links:
                  http://site/de/produkte/produktpalette/palblend-pc-abs-blends/palblend-r-45.pdf
                  ("de" used as key by babel extension)

                  system settings' filemanager_path: empty
                  system settings' filemanager_path_relative: yes
                  system settings' filemanager_url: empty
                  system settings' filemanager_url_relative: yes

                  Does anyone see a mistake I made here or has a solution for my problem? Any help will be greatly appreciated. Thanks!
                  • What happens if you create a static resource that is not part of the Babel system, and access it directly? I've found that the more layers of complexity between a request and its target, the more likelihood of something going wrong.
                      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
                    • Static Resources existing before Media Sources and have nothing to do with file_manager path either, they have their own settings for configuration. resource_static_path determines where the paths are relative to, or you can specify absolute paths. Heck, you can even use MODX tags to build the path dynamically. But if you avoid using the Media Source Browser to select the static files, you won't have any of these issues.