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

Upload Location? ImageGallery plus Subsites


Go to End


4 Posts   1140 Views

Avatar
Wilson

Community Member, 63 Posts

2 April 2010 at 3:02am

Hi UncleCheese,

Wondered if you might be able to help me debug an issue, or if you would be interested in an hour or two of work today?

I'm running SS 2.4beta1, recent ImageGallery mod and recent Subsites working. At one point last week, the project seemed to be very stable so I locked all their revision numbers in my externals. Everything's great.

The one last issue I have is that when a User uploads files in the Files & Images area, it uploads into the correct 'virtual' directory but then creates another blank 'virtual' parent directory. I've pored through FileDataObjectManager.php and the SWFUpload code, turned the debugger on, etc. But am not able to -pinpoint what's creating the extra Folder. Perhaps, it's a JOIN query in the SQL that's causing it? If I set the 'SubsiteID' to 0 in the File table, then it works, but the User can then see all of the other Users asset directories.

A minor related issue, is that the file is physically uploaded to the '/assets/' root instead of into the selected directory.

Everything appears OK to the end-user, except for the extra directory created.

Thanks for your time!

Wilson

Avatar
Wilson

Community Member, 63 Posts

2 April 2010 at 3:10pm

Still debugging. Everything looks fine in both the SWFUpload debugger and PHP logs (incidentally I found a nice way to debug the PHP functions that you can't see with SS debugger or FirePHP is just to write it to PHP error_log, probably obvious).

Is it possible there is a variable type issue? All of my asset folders are numbers, based on the ID of a particular store for this corporate HQ.

Thanks for any help anyone.

Avatar
Wilson

Community Member, 63 Posts

2 April 2010 at 4:44pm

The problem appears to be in line 23 of Folder.php.

$item = DataObject::get_one("Folder", "\"Name\" = '$part' AND \"ParentID\" = $parentID");

The filter is correct, but it's returning false.

Avatar
Wilson

Community Member, 63 Posts

2 April 2010 at 6:34pm

Crazy thing is I can do $item = DataObject::get_by_id('Folder', AN ID); and it works.

Something must be overriding 'get_one'?