Hi
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:
Problems with this code is that it lists all the files, and I just want the directories and when I click on the link, it goes to mydomainname.co m/directory name instead of mydomainname.co m/photo_upload/directory.
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:
Code:
<?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);
}
?>
Comment