I'm having some trouble making a script to list a given directory at the root of my website.
Basically this is how I have it set up...
root//
photo_upload <-- folder
proofing <--- PHP file
I want the proofing php file to LIST the folders inside the photo_upload.
If anyone could help, that'd be great.
Current this is the code that I have:
Expand|Select|Wrap|Line Numbers
- <?php
- $dir="photo_upload"; // Directory where files are stored
- if ($dir_list = opendir($dir))
- {
- while(($filename = readdir($dir_list)) !== false)
- {
- ?>
- <p><a href="<?php echo $filename; ?>"><?php echo $filename;
- ?></a></p>
- <?php
- }
- closedir($dir_list);
- }
- ?>