Jump to:

3448 Posts in 1062 Topics by 738 members

Data Model Questions

SilverStripe Forums » Data Model Questions » Multiple Image upload for specific page type

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

Page: 1
Go to End
Author Topic: 864 Views
  • RajBana
    Community Member
    1 Post

    Multiple Image upload for specific page type Link to this post


    I am new to silverstripe. I am trying to create a customized multiple image upload field for a specific page type following Silverstripe documentation (http://doc.silverstripe.org/framework/en/trunk/reference/uploadfield). I am using latest Siverstripe framework & cms . Now while running mysite/?flush its showing "Fatal error: Access level to ProductPageFile::$many_many must be public (as in class Page).... ".

    This is my page code:


    class ProductPageFile extends Page {
    private static $many_many = array('GalleryImages' => 'Image');

    function getCMSFields() {

    $fields = parent::getCMSFields();

    $uploadField = new UploadField(
    $name = 'GalleryImages',
    $title = 'Upload one or more images (max 10 in total)'

    return $fields;

    class ProductPageFile_Controller extends Page_Controller {
    function NewPublicUploads($FolderName) {
    $FolderName = str_replace(" ","-",$FolderName);
    return DataObject::get(
    $name = 'File',
    $filter = "ClassName = 'Image' and Filename like 'assets/".$FolderName."/%'",
    $sort = "Created DESC",
    $join = "",
    $limit = ""

    class GalleryImageExtension extends DataExtension {
    private static $belongs_many_many = array('Galleries' => 'ProductPageFile');


    can you please guide me to build a custom multiple image upload field for specific page type.

    Thank you.

  • kinglozzer
    Community Member
    139 Posts

    Re: Multiple Image upload for specific page type Link to this post


    It sounds like you're following the documentation for 3.1 when you're using 3.0.x. This is the documentation you should be using: http://doc.silverstripe.org/framework/en/reference/uploadfield.

    Change your private static $many_many to be public static $many_many, and do the same for your private static $belongs_many_many - should be public static $belongs_many_many.

    Apart from that, your code looks (at a glance) like it should work.

  • Naren
    Community Member
    21 Posts

    Re: Multiple Image upload for specific page type Link to this post

    Hi all,

    I want to create a page where I can show many products in a single page. There would be an image of product and some desprciption per product managed by CMS, can any one guide me how could I do that.

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.