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've moved the forum!

Please use for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

How do I change upload folder for gallery image?

Go to End

2 Posts   1205 Views


Community Member, 58 Posts

2 June 2015 at 5:14pm

Edited: 02/06/2015 5:16pm

I want to upload bulk images for gallery in 'gallery' folder instead of default 'bulkUpload'. I am using 'colymba / gridfield-bulk-editing-tools 2.1.1'
here is my code

public function getCMSFields() {
    $fields = parent::getCMSFields(); 
    $gridFieldConfig = GridFieldConfig_RecordEditor::create(); 
    $gridFieldConfig->addComponent(new GridFieldBulkUpload());
    $gridFieldConfig->addComponent(new GridFieldSortableRows('SortOrder'));
    $gridfield = new GridField("GalleryImages", "Gallery Images", $this->GalleryImages()->sort("SortOrder"), $gridFieldConfig);
    $fields->addFieldToTab('Root.Main', $gridfield);
    return $fields;    


Community Member, 107 Posts

2 June 2015 at 10:04pm

Edited: 02/06/2015 10:06pm

insert the code after you add GridFieldBulkUpload component

    ->setUfSetup('setFolderName', 'ur-folder-name')
    ->setUfConfig('sequentialUploads', true);

for more info