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.

Data Model Questions /

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

Multiple Image upload for specific page type

Go to End

3 Posts   3129 Views


Community Member, 1 Post

3 September 2013 at 11:26pm


I am new to silverstripe. I am trying to create a customized multiple image upload field for a specific page type following Silverstripe documentation ( 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.


Community Member, 187 Posts

4 September 2013 at 2:56am


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:

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.


Community Member, 21 Posts

22 October 2013 at 9:46pm

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.