[SOLVED] Reading directories
Posted: Sun Jan 29, 2006 7:02 pm
hello,
for an update page, i would like to open OR make the image directory if it doesn't exist.
i started with this:
and it would work if the directory exists. if it didn't, the error message would show on a white page.
i added the mkdir to this and the directory was created.
now, i get this error, and it doesn't read the directory (which makes sense from the error):
Does anyone have any idea why it's being fussy over the readdir and closedir?
for an update page, i would like to open OR make the image directory if it doesn't exist.
i started with this:
Code: Select all
$dir_handle = @opendir($path) or die("Unable to open $path");
while ($file = readdir($dir_handle))
{
if($file != "." && $file != "..")
{
$imagearray[] = $file;
}
}
closedir($dir_handle);
$numimages=0;
if($imagearray)
{
sort($imagearray);
$numimages = count($imagearray);
}i added the mkdir to this and the directory was created.
Code: Select all
$dir_handle = @opendir($path) || @mkdir($path) or die("Unable to open $path");
while ($file = readdir($dir_handle))
{
if($file != "." && $file != "..")
{
$imagearray[] = $file;
}
}
closedir($dir_handle);
$numimages=0;
if($imagearray)
{
sort($imagearray);
$numimages = count($imagearray);
}Code: Select all
Warning: readdir(): supplied argument is not a valid Directory resource in /home/.ufowasherkiln/meaghanb/londonindie.com/admnband/bands/editband.php on line 26
Warning: closedir(): supplied argument is not a valid Directory resource in /home/.ufowasherkiln/meaghanb/londonindie.com/admnband/bands/editband.php on line 34Does anyone have any idea why it's being fussy over the readdir and closedir?