Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Automatically adding file size to a linked file


Reply


342 Views

Avatar
MCK

Community Member, 9 Posts

14 September 2012 at 9:17am

Looking through the documentation, I see that you can get the size of a file with $File.Size. However, I would like to automatically add the file size when the admin adds a link to the file in the CMS. For example:

<a title="Population" href="http://.../assets/Factsheets/Population-Change.pdf" target="_blank">Estimated total NZ population temporal trend</a>

changed to:

<a title="Population" href="http://.../assets/Factsheets/Population-Change.pdf" target="_blank">Estimated total NZ population temporal trend (2.1MB)</a> (the file size added in brackets)

automagically, i.e., without the user having to find the file size and manually add it.

Possible?

Graeme