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:

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

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


Go to End


14 Posts   3288 Views

Avatar
brice

Community Member, 52 Posts

3 September 2010 at 5:17am

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) {

Avatar
UncleCheese

Forum Moderator, 4102 Posts

3 September 2010 at 7:15am

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.. http://www.leftandmain.com

Avatar
benni91

Community Member, 72 Posts

28 August 2011 at 1:45pm

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

Avatar
UncleCheese

Forum Moderator, 4102 Posts

31 August 2011 at 1:43am

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

--------------------
SilverStripe tips, tutorials, screencasts and more: http://www.leftandmain.com

Avatar
benni91

Community Member, 72 Posts

31 August 2011 at 2:24am

Edited: 31/08/2011 2:25am

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

Avatar
UncleCheese

Forum Moderator, 4102 Posts

1 September 2011 at 1:15am

You're remembering to click "change?"

--------------------
SilverStripe tips, tutorials, screencasts and more: http://www.leftandmain.com

Avatar
benni91

Community Member, 72 Posts

1 September 2011 at 5:12am

Yep ;)

Avatar
benni91

Community Member, 72 Posts

2 September 2011 at 2:41am

Can you help?

Go to Top