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.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Customising the CMS /

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

Uploaded File Management on a Page

Go to End

5 Posts   976 Views


Community Member, 46 Posts

26 April 2013 at 1:44am


I've got the front page of a site showing a slideshow, which uses images selected by the user through the CMS.

The code added to the back end is as follows:

class HomePage extends Page {
	static $many_many = array (
		'FrontImages' => 'Image'
	static $allowed_children = '';
	public function getCMSFields() {
        $fields = parent::getCMSFields();
		$f = new UploadField('FrontImages', 'Front Images (Maximum of 10 images. Allowed files: .jpg, .jpeg, .png or .gif)', $this->FrontImages()); 
		$f	->setConfig('allowedMaxFileNumber', 10)
			->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif'));
		$fields->addFieldToTab('Root.Images', $f);
        return $fields;

This loads the boxes fine. However (as shown in the screenshot), there's no remove or delete buttons for the already uploaded images. Any help would be appreciated :)

Thanks in advance!

Attached Files

Community Member, 18 Posts

29 April 2013 at 11:05am

Edited: 29/04/2013 11:07am


Where are the images being uploaded to? Have you checked your asset folder under the "Files" menu item on the left hand side?

It could be that Silverstripe sees that directory and you can control that directory from the File manager and you can delete, change, and add more files in/from there?

If that doesn't work then you may have to code those features into this custom page?

I'm still learning quite a lot, but what I've said above is just an idea to check out.


It just clicked to me that the file manager would only pick it up if your images folder you created to keep those images, might only show up if they are inside the assets folder? If not then you definitely might have to code those features in (delete, edit etc), something I'd be interested in in the future as well.


Community Member, 1 Post

7 May 2013 at 5:27pm


I have the same issue, were you able to find a solution?


Community Member, 46 Posts

18 June 2013 at 8:56am

Sorry for the very long delay (shows how often I check back).

I never found a solution, but would love to know one!

The images are uploaded to Assets/Images (as defined in the code), but the images on the front page itself are pulled through using the following:

<div id="slideshow">
	<ul id="carousel">
	<% loop $FrontImages %>
	<% end_loop %>

The code in my first post has not changed.



Community Member, 46 Posts

6 July 2013 at 1:09am

Edited: 06/07/2013 1:10am

I know this topic's a bit old, but I just thought I'd post a solution (finally).

In my first post, I had the following code:

 $f = new UploadField('FrontImages', 'Front Images (Maximum of 10 images. Allowed files: .jpg, .jpeg, .png or .gif)', $this->FrontImages()); 

However, the issue was the linking. Simply remove the red part as it seems to link everything up nicely anyway.

 $f = new UploadField('FrontImages', 'Front Images (Maximum of 10 images. Allowed files: .jpg, .jpeg, .png or .gif)', $this->FrontImages()); 

I hope this helps someone in the future :)