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?