Hello,
I have a script wich shows the number and the foto's in a dir.
The script knows wich dir it is because a variable is passed trough the url.
<?php
$direct = $_GET["dirname"]."/";
if ($handle = opendir($direct)) {
$foto = "0";
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
$foto++;
}
}
}
closedir($handle);
echo "Er zitten ".$foto." Foto's in $direct;";
echo "<div align=\"center\">";
echo "<table border=\"0\" cellspacing=\"1\" width=\"756\">";
$dir = $direct;
$num_columns=4; // number of columns
// Open a known directory, and proceed to read its contents
echo "<table border=0 cellpadding=3 cellspacing=0><tr>";
if (is_dir($dir))
{
if ($dh = opendir($dir))
{
$i = 0;
while ($file = readdir($dh))
{
$strFile = $dir."/".$file;
if(!is_dir($strFile))
{
$i++;
echo "<td valign=top>";
echo "<a href=\"$strFile\" ><img src=\"$strFile\" alt=\"Druk op de knop om het hele plaatje te zien\" border=0 width=\"178\"></a>";
echo "</td>";
if(is_int($i/$num_columns))
{
echo "</tr><tr>";
}
}
}
closedir($dh);
}
}
echo "</tr></table>";
?>
When i run it it says:
Warning: OpenDir: Invalid argument (errno 22) in c:\phpdev\public\imlooker.php on line 3
Warning: closedir(): supplied argument is not a valid Directory resource in c:\phpdev\public\imlooker.php on line 11
Er zitten Foto's in modellen/;