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

Problem while uploading multiple images




2 June 2013 at 12:46am Community Member, 8 Posts

I am trying to upload multiple photos with a caption.
But after adding caption for all the uploaded pictures, when i click 'finish' button, it does not come back to the page it started from.

Please help..

* Defines the HomePage page type

class HomePage extends Page {
static $db = array(
    'Description' => 'Text'
static $has_one = array(
    'ProfileImage' => 'CustomImage'
   public static $has_many = array(
'AttachedFiles' => 'SlideShow',
      'AttachedPhotos' => 'PhotoStream',   
      'HolidayPictures' => 'HolidayPicture'


public function getCMSFields() {
$fields = parent::getCMSFields();

$fields->addFieldToTab('Root.Content.Main', new FileUploadField('ProfileImage', 'Upload a profile image'));
      /* Add the code below this line */
      // This adds a DataObjectManager to a new tab
      $manager = new ImageDataObjectManager(
            'Caption' => 'Caption'
      $fields->addFieldToTab("Root.Content.HolidayPictures", $manager);

return $fields;


class HomePage_Controller extends Page_Controller {
public function init()




and HolidayPictures.php:

class HolidayPicture extends DataObject
   static $db = array (
      'Caption' => 'Text'
   static $has_one = array (
      'Attachment' => 'CustomImage',
      'EmployeePage' => 'EmployeePage'
   public function getCMSFields_forPopup()
      return new FieldSet(
         new FileUploadField('Attachment', 'Add a holiday picture'),
         new TextAreaField('Caption', 'Add a caption')