Keyword

Attachments directory per category - possible?

More
12 years 2 months ago #101421 by Ryan
Hi All,

Does anyone know of any hacks to allow the use of a separate upload directory per category?

The reason being, we have about 10 categories (with nesting).

We will have about 5000 documents in here, and I REALLY don't want to have them all in one directory.

Docman used to have this method, but they now use recursive folders for categories, which is really good for physical file management.

If anyone has any ideas on this i'd greatly appreciate it.

Regards

Ryan

Please Log in or Create an account to join the conversation.

More
12 years 2 months ago #101422 by Ryan
Surprised this has't intruiged anyone.

Well, I'm going through the requirements of this.

Backup first!

Page to modify:
administrator > components > com_k2 > models > item.php

Line 493 & 497
Also for the delete function: line 1030
 $path = $params->get('attachmentsFolder', NULL);
			
            if (is_null($path))
            {
		// start edit to define disting category upload path added $row->catid
                $savepath = JPATH_ROOT.DS.'media'.DS.'k2'.DS.'attachments' . $row->catid;
		// original
                //$savepath = JPATH_ROOT.DS.'media'.DS.'k2'.DS.'attachments';
            }
            else
            {
                $savepath = $path;
            }

for the actual download, we also need to get access to the category id;
find:
 function download()

tried adding:
$db = &JFactory::getDBO();
        $user = &JFactory::getUser();
        $row = &JTable::getInstance('K2Item', 'Table');

But this doesn't work. Anyone got any ideas?

Perhaps this isn't the best way to do it, but initial tests have shown it works, and of course needs documenting, testing, and backing up.

Each update to k2 will destroy these changes, so, maybe not the best...

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum