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 forum.silverstripe.org 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.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

[SOLVED] removeFolderSelection + Uploadify + DOM


Go to End


2 Posts   1106 Views

Avatar
Ryan M.

Community Member, 309 Posts

25 March 2011 at 2:07pm

I'm removing the upload folder selection & manually setting the upload folder on the DOM popup for a dataobject. Code below:

public function getCMSFields_forPopup()
	{
		$upload = new ImageUploadField('Image');
		$upload->removeFolderSelection();
		$upload->uploadFolder = 'Photos';
		$f = new FieldSet(
			new TextField('Title'),
			new TextareaField('Description'),
			$upload
		);
		if($this->ID) {
			$f->push(new DropdownField('PhotoAlbumID', 'Attach to a Photo Album', $this->profileAlbumsDropdown()));
		}
		return $f;
	}

When you're creating a new object, the upload folder selector is visible. However after saving it, then clicking to edit it in the DOM again, the folder selection is hidden, just like it's supposed to be. What gives?? Why is it displaying the selector at first, but not after creation?

Avatar
Ryan M.

Community Member, 309 Posts

25 March 2011 at 2:17pm

I quickly discovered that because I'm using an ImageDOM, the initial creation of the object uses the DOM's default upload folder, while editing the object later on uses the ImageUploadField's upload folder. Weird.

The solution was to also set the upload folder on the ImagDOM, however I don't think there's a method for removing the ability to change/select the upload folder.