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.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

General Questions /

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

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

Uploading downloadable documents

Go to End

2 Posts   581 Views


Community Member, 2 Posts

14 December 2012 at 2:27am


Am totally new to Silverstripe so am only competent with absolute basics at the moment. Currently I am just working on getting the content up and a vague order to things - I will work on the aesthetics later when I understand a bit more.

I need to have a section where I can have documents such as forms and information packs that people can download. So word and pdf documents which you can click on and either open or download. How possible is this and if it's easy, how do I go about it?

Please use simple language if explaining else I won't have a clue!



Community Member, 545 Posts

14 December 2012 at 3:51am

Super simple, if you don't need front end upload. You'd just need to create a cusotm page type and give it a $has_many relation with the File Object

Then in that custom page template call some thing like
<% loop Files %>
<a href="$Filename">$Name</a>
<% end_loop %>

This assume you create the relation as
static $has_many = array("Files" => "File",);

In the template you could also use $Title instead of $Name if you don't want to see the extension.

Welcome to SilverStripe. I started using it a few years ago with 0 PHP knowledge, great way to learn since it handles all the messy parts of the Database part and wraps it in a really easy to use/learn method