Jump to:

7940 Posts in 1543 Topics by 946 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » Problem while uploading multiple images

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1
Go to End
Author Topic: 722 Views
  • neerom
    Community Member
    8 Posts

    Problem while uploading multiple images Link to this post

    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')

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.