<![CDATA[ Static Resource empty - My Forums]]> https://forums.modx.com/thread/?thread=80134 <![CDATA[Static Resource empty]]> https://forums.modx.com/thread/80134/static-resource-won-t-download?page=3#dis-post-441503
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]]>
bequadrat Oct 26, 2012, 10:29 AM https://forums.modx.com/thread/80134/static-resource-won-t-download?page=3#dis-post-441503
<![CDATA[Re: Static Resource empty]]> https://forums.modx.com/thread/80134/static-resource-won-t-download?page=3#dis-post-561691 Quote from: screenager24 at Sep 19, 2018, 10:57 AM
Had the same problem recently and managed to solve it simply by changing resource's template to "empty". I Thought that static resources doesn't care about template field but it appears that they do.

To ensure your file is transmitted correctly, you should use the (empty) template. The static resource becomes a link to the file as long as you use this template. If you need to add some meta information to the resource via some Template Variables, and you create your own 'empty' template to enable this, then you must set the contents of the template to [[*content]] before it will work correctly.

https://docs.modx.com/revolution/2.x/making-sites-with-modx/structuring-your-site/resources/static-resource

Damn it! Just started a new thread on this before I saw this post. Fixed it instantly. You're my hero.]]>
claytonk Sep 21, 2018, 08:46 PM https://forums.modx.com/thread/80134/static-resource-won-t-download?page=3#dis-post-561691
<![CDATA[Re: Static Resource empty]]> https://forums.modx.com/thread/80134/static-resource-won-t-download?page=3#dis-post-561685
One sets all the stuff that's obvious for a new resource type, but forget to change the template since it's defaulted to either id 1 or whatever we set it to. Save, then it doesn't work and after all kinds of searches and questions (i.e. TIME), the obvious is that it's not set to empty.

This should be more clear now.
https://docs.modx.com/revolution/2.x/making-sites-with-modx/structuring-your-site/resources/static-resource

]]>
frogabog Sep 21, 2018, 10:11 AM https://forums.modx.com/thread/80134/static-resource-won-t-download?page=3#dis-post-561685
<![CDATA[Re: Static Resource empty]]> https://forums.modx.com/thread/80134/static-resource-won-t-download?page=3#dis-post-561630
To ensure your file is transmitted correctly, you should use the (empty) template. The static resource becomes a link to the file as long as you use this template. If you need to add some meta information to the resource via some Template Variables, and you create your own 'empty' template to enable this, then you must set the contents of the template to [[*content]] before it will work correctly.

https://docs.modx.com/revolution/2.x/making-sites-with-modx/structuring-your-site/resources/static-resource]]>
screenager24 Sep 19, 2018, 10:57 AM https://forums.modx.com/thread/80134/static-resource-won-t-download?page=3#dis-post-561630
<![CDATA[Re: Static Resource empty]]> https://forums.modx.com/thread/80134/static-resource-won-t-download?page=2#dis-post-449655 sottwell Jan 07, 2013, 04:14 PM https://forums.modx.com/thread/80134/static-resource-won-t-download?page=2#dis-post-449655 <![CDATA[Re: Static Resource empty]]> https://forums.modx.com/thread/80134/static-resource-won-t-download?page=2#dis-post-449640 Quote from: sottwell at Jan 07, 2013, 06:03 PM
So who do I talk to if I want to pay for this to be done? Or am I being presumptuous?
There are a great number of features I want to get into core this year, including some significant improvements and/or refactorings of Media Sources themselves. At the moment, the implementation of Media Sources is still incomplete within MODX, and in some cases broken. I've been divided on when exactly certain changes to Media Sources would be scheduled (2.3, 3.0, etc.) and am similarly divided on integrating them as they exist into Static Resources for 2.3 as a result.

Is the main goal to be able to properly use the Media Source Browser when selecting files for Static Resources or to associate their location with a specific Media Source? If the former, this will require core modification. If the latter, you can easily use a Snippet within the Static Resource path value to prepend a Media Source path or URL, e.g.
[[getMediaSourceBasePath]]relative/path/to/file.ext
]]>
opengeek Jan 07, 2013, 02:02 PM https://forums.modx.com/thread/80134/static-resource-won-t-download?page=2#dis-post-449640
<![CDATA[Re: Static Resource empty]]> https://forums.modx.com/thread/80134/static-resource-won-t-download?page=2#dis-post-449625 sottwell Jan 07, 2013, 12:03 PM https://forums.modx.com/thread/80134/static-resource-won-t-download?page=2#dis-post-449625 <![CDATA[Re: Static Resource empty]]> https://forums.modx.com/thread/80134/static-resource-won-t-download?page=2#dis-post-449618 Quote from: sottwell at Jan 07, 2013, 01:42 PM
Is there some fundamental reason why static resources should not be able to use a Media Source? Or is it just a matter of getting the code modified to have them do so? And if it is possible, and reasonable, how would I go about getting such a thing on a fast track? I had thought "Emergency Support", but this isn't exactly an emergency, just something I'd like to get done in the near future, as I have an immediate use case for it.

I have in mind being able to implement a single corporate-wide document repository, where .pdf and .doc documents will reside. All documents relating to a given product will be listed in a MIGXdb TV using static resources and a custom Media Source into that corporate repository.

No fundamental reason other than complexity of implementation and it just hasn't been done yet.]]>
opengeek Jan 07, 2013, 11:35 AM https://forums.modx.com/thread/80134/static-resource-won-t-download?page=2#dis-post-449618
<![CDATA[Re: Static Resource empty]]> https://forums.modx.com/thread/80134/static-resource-won-t-download?page=2#dis-post-449578
I have in mind being able to implement a single corporate-wide document repository, where .pdf and .doc documents will reside. All documents relating to a given product will be listed in a MIGXdb TV using static resources and a custom Media Source into that corporate repository.]]>
sottwell Jan 07, 2013, 07:42 AM https://forums.modx.com/thread/80134/static-resource-won-t-download?page=2#dis-post-449578
<![CDATA[Re: Static Resource empty]]> https://forums.modx.com/thread/80134/static-resource-won-t-download?page=2#dis-post-444014 Quote from: opengeek at Oct 29, 2012, 11:05 PM
I just tested the same thing and it worked as expected at the URL of the static resource. I think maybe you are battling some other demons here, but I'm not sure what. Perhaps this is a babel issue?

Seems it had something to do with babel. After fiddling with the .htaccess now everything works as expected. I used the default "File System" media-source to select a file which now downloads correctly. However, I want to restrict the filesystem access for my client to specific media sources, so it would be great if static resources would support media sources in future versions.

Thanks sottwell and opengeek!]]>
bequadrat Nov 21, 2012, 06:43 AM https://forums.modx.com/thread/80134/static-resource-won-t-download?page=2#dis-post-444014