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

setAllowedExtensions and setFolderName

Go to End

5 Posts   2275 Views


Community Member, 23 Posts

27 April 2009 at 2:22pm


I'm making a module and I'm trying to do the following:

function getCMSFields_forPopup() {
$CardImageField = new ImageField( 'CardImage' );
$CardImageField->setAllowedExtensions(array( 'png' ));
$CardImageField->setFolderName( 'flashcards' );

$fields = new FieldSet();
$fields->push( new TextField( 'CardName' ) );
//$fields->push( new ImageField( 'CardImage' ) );
$fields->push( $CardImageField );
$fields->push( new TextField( 'CardContent' ) );
return $fields;

I could see in an earlier thread that setAllowedExtensions() and setFolderName() does not work on ImageField. Is there any other way to do this?

Are there any plans about fixing it?


Community Member, 18 Posts

15 August 2009 at 1:37am

To have a method documented in the API but not working is bad form - and not having any replies to this post either.

So, is it going to be fixed?


Forum Moderator, 5523 Posts

16 August 2009 at 6:34pm

PeterB - I recommend posting this issue and a test case of what is broken on (or there may even be an existing ticket - which in that case, do nothing).

Make sure you include the version of SilverStripe you are using and if you are not using trunk then you might want to download that and attempt it and see if it has been fixed in trunk.


Community Member, 244 Posts

16 August 2009 at 7:30pm

I fixed these issues a while ago in trunk with a FileIFrameField & ImageField refactoring - however, these fixes are not available in the 2.3 branch.


Community Member, 18 Posts

17 August 2009 at 7:52pm

How stable is trunk and is it ready for production use? Compatibility of modules would be a concern as my site's making heavy use of them.

Can I suggest that documentation (both normal and API docs) is versioned? That way it becomes clear what's usable in trunk and what's usable in the 'stable' 2.3 release. The Kohana team had this issue, and they've adopted a similar approach to Symfony & Doctrine with their documentation.