I've done this script based on quite a few postings on php.net and with a few bits of nice html thrown in there.
I'm not a programming wizz, but the problem is, it's only showing around 13 entries in the directory, and I know there are more files in there than that!
<?php
// Show directory listing and link to filedetail.php to get size etc
// A few vars
$directory_to_show = dir("/path/to/directory/");
$base_url = ("http://www.url.com/directory/");
?>
<style>
.diddytext { font-family: Arial, sans-serif; font-size: 8pt; }
</style>
<body bgcolor="#FFFFFF" link="#660066">
<table width="100%" border="0" cellspacing="0">
<tr valign="top">
<td width="50%">
<table width="300" border="0" cellspacing="1" cellpadding="3" bgcolor="#999999">
<tr>
<td class="diddytext"><b><font color="#FFFFFF"> File Listing for</b> <?php echo ("$base_url"); ?><br>
<img src="images/1x1.gif" width="150" height="1" border="0"></font></td>
</tr>
<tr>
<td bgcolor="#FFFFFF">
<table width="100%" border="0" cellspacing="1" cellpadding="0" bgcolor="#666666">
<tr>
<td class="diddytext"><b><font color="#FFFFFF"> File</font></b></td>
<td class="diddytext" width="50" align="center"><b><font color="#FFFFFF">Use?</font></b></td>
</tr>
<?php
// DirList Loop & Link
$accepted_types = array(".pdf"=>"y",".gif",".jpg"=>"y");
while ($entry = $directory_to_show->read()) {
if ($entry != "." && $entry != ".."){
$extension = strtolower(substr($entry,strpos($entry,".")));
// is this file type in the accepted types array?
if ($accepted_types[$extension])
{
print <<<EOF
<tr bgcolor="#FFFFFF">
<td class="diddytext"> $entry</td>
<td class="diddytext" width="50" align="center"><b><a href="filedetail.php?where=$base_url$entry&file=$entry">USE</a></b></td>
</tr>
EOF;
}}}
//Close Call
$directory_to_show->close();
//End html
print <<<EOF
</table>
</td>
</tr>
</table>
EOF;
?>
Also, why is it when I ask for a file's size using the filesize() call within the whil loop that it shows nothing???
Hope someone can help.
:0))
S.