ttist25
asked on
PHP to mimick DirectoryIndex
Hey there!
How can I modify this:
<?php
if ($handle = opendir('pics')) {
echo "Directory handle: $handle\n";
echo "Files:\n";
// List all the files
while (false !== ($file = readdir($handle))) {
echo "$file\n";
}
closedir($handle);
}
?>
to display a list of links to files in the pics directory?
I'm trying to get the same functionality that DirectoryIndex *.* in a .htaccess file would provide but my host doesn't allow custom .htaccess files.
I'm also open to alternative methods that might be more elegant.
TIA
How can I modify this:
<?php
if ($handle = opendir('pics')) {
echo "Directory handle: $handle\n";
echo "Files:\n";
// List all the files
while (false !== ($file = readdir($handle))) {
echo "$file\n";
}
closedir($handle);
}
?>
to display a list of links to files in the pics directory?
I'm trying to get the same functionality that DirectoryIndex *.* in a .htaccess file would provide but my host doesn't allow custom .htaccess files.
I'm also open to alternative methods that might be more elegant.
TIA
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Nice job! Thanks.