- Category: SilverStripe
- Last edited: May 7, 2013
Instead of scrambling around the /assets folder trying to find the folder that contains your assets, set the default folder to start the search from with one sneaky line in your class:
// create field
$thumbnailField = new UploadField( 'Picture', 'My Picture' );
// set /assets/MyPictures as default folder
$thumbnailField->setFolderName('MyPictures');
// add field to $fields object
$fields->addFieldToTab("Root.Main", $thumbnailField );