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.

DataObjectManager Module

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Uploadify: patch which sets folder dropdown to $uploadFolder by default

Go to End

14 Posts   2274 Views


3 September 2010 at 5:17am Community Member, 51 Posts

Using uploadify, I noticed that if I set uploadFolder (e.g. to "Videos") & then allow folder selection during uploads, the dropdown for folder selection ALWAYS resulted in "assets/Uploads" being highlighted by default -- instead of "assets/Videos".

Below is a patch to correct. From what I gather, this was the intended behavior, as the $folder variable was never accessed after checking if $uploadFolder exists.

Index: www/uploadify/code/UploadifyField.php
--- www/uploadify/code/UploadifyField.php   (revision 13)
+++ www/uploadify/code/UploadifyField.php   (working copy)
@@ -485,7 +485,7 @@
   public function CurrentUploadFolder() {
      if($this->uploadFolder) {
-         $folder = Folder::findOrMake($this->uploadFolder);
+         return Folder::findOrMake($this->uploadFolder);
      if($result = $this->Files()) {
         if($result instanceof File) {


3 September 2010 at 7:15am 4085 Posts

Thanks, Brice. Yeah, this function changed a number of times before I figured out exactly how I wanted it to work, so I'm not surprised. I originally had that second if block as an elseif, but either way the result is the same. Thanks for the patch.

Silverstripe tips, tutorials, screencasts, and more..


28 August 2011 at 1:45pm Community Member, 72 Posts

I downloaded the latest version of unlcecheese's uploadify for ss. where should i put your code in brice? i can't find this code segment in the uploadifyfield.php :/

thanks benni


31 August 2011 at 1:43am 4085 Posts

That patch isn't valid anymore because that function has changed. What is the issue you're having?

SilverStripe tips, tutorials, screencasts and more:


31 August 2011 at 2:24am (Last edited: 31 August 2011 2:25am), Community Member, 72 Posts

Doesn't matter which folder i choose. the upload is always into the folder "Uploads" and NOT into the selected one.

// i'm using the latest version of your uploadify


1 September 2011 at 1:15am 4085 Posts

You're remembering to click "change?"

SilverStripe tips, tutorials, screencasts and more:


1 September 2011 at 5:12am Community Member, 72 Posts

Yep ;)


2 September 2011 at 2:41am Community Member, 72 Posts

Can you help?

Go to Top