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.

DataObjectManager Module

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Controlling Uploadify files from templates

Go to End

12 Posts   2248 Views


18 March 2011 at 7:18am Community Member, 73 Posts

Hi there,

I'm lost with this part of Silverstripe. I've been using it succesfully from 2 years or more, but one feature i never understood is to upload several files into a simple pagetype.

So, after days of trying different modules, i've uploades DataObjectManager module and Uploadify.

I must say that documentation is not so clear on these ones, but i've managed to get them working on a future site i'm planning to launch.

I've followed the instructions on Uploadify module, and i've sucesfully uploaded several documents into the MyPageWithFiles page type on my test site

Now, the question is:

How do i control those files from the templates? I don't have the knowledge to code that. Is documented somewhere? Am i missing installing another module?

thanks in advance,



18 March 2011 at 7:34am 4085 Posts

<% control YourFileObjects %>
$Field1 $Field2, etc..
<% control YourFileRelation %>
$URL $Size $Extension, etc...
<% end_control %>
<% end_control %>


18 March 2011 at 7:42am Community Member, 73 Posts


Thanks very much from your quick answer!

In my case i have 2 pagetypes as you explain on the tutorial:


class MyPageWithFiles extends Page {

   static $has_many = array (
      'AttachedFiles' => 'MyFile'

   public function getCMSFields() {
      $fields = parent::getCMSFields();
      $fields->addFieldToTab("Root.Content.Files", new MultipleFileUploadField('AttachedFiles','Upload several files'));
      return $fields;

class MyPageWithFiles_Controller extends Page_Controller {

    * An array of actions that can be accessed via a request. Each array element should be an action name, and the
    * permissions or conditions required to allow the user to access it.
    * <code>
    * array (
    * 'action', // anyone can access this action
    * 'action' => true, // same as above
    * 'action' => 'ADMIN', // you must have ADMIN permissions to access this action
    * 'action' => '->checkAction' // you can only access this action if $this->checkAction() returns true
    * );
    * </code>
    * @var array
   public static $allowed_actions = array (

   public function init() {

      // Note: you should use SS template require tags inside your templates
      // instead of putting Requirements calls here. However these are
      // included so that our older themes still work


class MyFile extends File {

   static $has_one = array (
      'MyPageWithFiles' => 'MyPageWithFiles'


Is this right?

How it would be the code for the calls you've stated previously on your first answer?

Thank you very much



18 March 2011 at 8:02am 4085 Posts

In that case, you would just use:

<% control AttachedFiles %>
$URL $Extension $Size etc..
<% end_control %>


18 March 2011 at 8:09am Community Member, 73 Posts


it worked great! i need this implementation because i'm planning to place a slideshow with 'n' files, and it the past i hardcoded each slideshow, pretty unfuncitional.

Do this variables documented in some place?

I have one last question:

i've saw your tutorials explaining the sort capability on the Uploadify module, and you said something like there is a module installed wich allows you to do that, can you tell me how to do it? because i don't understand you clearly (my english is fair, i'm from Buenos Aires)

thank you very much, great work you've done here! :)



18 March 2011 at 8:52am 4085 Posts

Glad it worked for you!

If you have DataObjectManager installed, the files should be sortable when using a MultipleFileUploadField.


18 March 2011 at 9:39am Community Member, 73 Posts


I have the field declared as you say, but i cannot drag the item, it appears de cross over each item, but i cannot sort them.

There is something i don't understand:
You tell me "if i have dataobjectmanager installed", yes, i have it installed, and the question is:

Isn't suppossed that i MUST install it in order to uploadify work properly?

In fact, i had problems with DataObjectManager installation, since there's missing the classic "install.txt" file that appears on each module, and by now i left the module on /DataObjectManager

Maybe that's causing some problems?

Thank you again



19 March 2011 at 4:10am 4085 Posts

The DataObjectManager module should be installed in a folder named "dataobject_manager", not "DataObjectManager"..

Go to Top