Jump to:

23453 Posts in 18904 Topics by 2877 members

General Questions

SilverStripe Forums » General Questions » Automatically adding file size to a linked file

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

Page: 1
Go to End
Author Topic: 263 Views
  • MCK
    Avatar
    Community Member
    9 Posts

    Automatically adding file size to a linked file Link to this post

    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

    263 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.