Wayneio Posted January 25, 2012 Share Posted January 25, 2012 Hi, I have coded a site, whereby users can log in, and depending on their group, view all files within their group directory: if ($handle = opendir("storage/Admin/$group")) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { echo "<a target=\"_blank\" href=\"storage/Admin/$group/$file\">$file</a> <br />"; } } closedir($handle); } In this example, a user can click on their file, and it will let them download it, but if there is a folder (directory) in there, once clicked on, it will open a index of the directory. Is there a way instead, to let it open a custom page and list the files within it there? Quote Link to comment https://forums.phpfreaks.com/topic/255747-i-can-read-files-but-what-about-folders/ Share on other sites More sharing options...
litebearer Posted January 25, 2012 Share Posted January 25, 2012 perhaps create a file in the subfolder like this http://www.liamdelahunty.com/tips/php_list_a_directory.php and simply EXCLUDE it when displaying Quote Link to comment https://forums.phpfreaks.com/topic/255747-i-can-read-files-but-what-about-folders/#findComment-1311023 Share on other sites More sharing options...
Wayneio Posted January 25, 2012 Author Share Posted January 25, 2012 perhaps create a file in the subfolder like this http://www.liamdelahunty.com/tips/php_list_a_directory.php and simply EXCLUDE it when displaying Thanks, think I understand this. (Quite a PHP Noob atm) Would there be an easy way to change that code, so that instead of just excluding the directory, it makes it a link to only display files then within that directory? Quote Link to comment https://forums.phpfreaks.com/topic/255747-i-can-read-files-but-what-about-folders/#findComment-1311026 Share on other sites More sharing options...
Wayneio Posted January 25, 2012 Author Share Posted January 25, 2012 Example: file1.txt file2.img dir1 dir2 file3.doc files open, but directories just index so i need it, so when click on dir 1, it would then list files from there dir1file1.jpg dir1file2.xls etc Quote Link to comment https://forums.phpfreaks.com/topic/255747-i-can-read-files-but-what-about-folders/#findComment-1311050 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.