Organizing files in folders

Permalink
Hi,
I would like to build some kind of file repository so visitors could download pdfs, etc. I know concrete5 organizes files in sets instead of folders, but I think it would be extremely helpful for me to develop that feature.
My idea is to create something similar to a folders tree using the sitemap structure and display them with a "PageList" block. I think the easiest way could be something like "External Page" changing the "Add external file" form so editors could pick the url from a file in the filemanager instead of the URL text field.

Is there any way so I can customize that form or, even better, create a new item so editors could choose "Add page", "Add external link" or "Add File from file manager"
I would appreciate any help. Thanks in advance

 
JohntheFish replied on at Permalink Reply
JohntheFish
There was a lot of discussion on this 18 months+ ago. If you search back you should find it - probably best to use Google.

I think someone may have solved it. But there are security issues. As soon as the files follow a regular structure anyone can guess where they are saved.

If I were developing something like this, I would keep the files in the c5 file manager with the randomized directories, then use filesets or attributes to organise a pseudo-hierarchy that I could then display visually as a hierarchy. That would be both easier to implement and more secure.
dicoruna replied on at Permalink Reply
Thanks a lot JohntheFish for your help,

I will try to find the solution you mentioned. I could solve it with the pseudo-hierarchy you proposed but I'm not sure if I can rely on content editors to manage it on their own. I'd like them to be as independent as possible so they don't need me every time they need to create a tree of folders.

Thank you again!
dicoruna replied on at Permalink Reply
I finally found an easy solution creating a new Page Type named "File" with a file attribute. I added some code to include a meta tag inside the header so it redirects to the attached file. This way I can use the same sitemap structure to categorize files and pages.
I could change the pagelist template to use the file url instead of page url if page type is "File". This is the code just in case someone could find it useful.

<!doctype html>
<html><head> <!-- Site Header Content //-->
<?php
$page = Page::getCurrentPage();
$f = $page->getAttribute('file_page');
$fv = $f->getApprovedVersion();
$url = $fv->getDownloadURL();
?>
    <meta http-equiv="refresh" content="0;URL='<?php echo $url?>'" />
JohntheFish replied on at Permalink Reply
JohntheFish
Very neat. You could write that up as a howto.