Hi,
I have my PHP 5 running in IIS 6.0. I have my application hosted on IIS. I need to list all the contents of a specific folder in the server as as hyperlinks in my HTML. I was trying to use the PHP code. But, it does not work when I embed in the HTML.
Is there a better way to embed PHP in HTMLs?
Please help me with the php code that serves this purpose.
$dir = opendir('files/');
echo '<ul>';
while ($read = readdir($dir)) {
if ($read!='.' && $read!='..') {
echo '<li><a href="files/'.$read.'">'.$read.'</a></li>';
}
}
echo '</ul>';
closedir($dir);
_____ERROR_____________
.$read.''; } } echo '
'; closedir($dir); ?>
_________________________
Thanks.
Subs
PHP code to List folder contents as HTML hyperlinks
Moderator: General Moderators
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: PHP code to List folder contents as HTML hyperlinks
Is the file extension .php? The webserver probably won't parse the PHP code if not.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.