Invalid directory resource

From: Date: Sat, 08 Jul 2000 19:29:05 +0000
Subject: Invalid directory resource
Groups: php.general 
Request: Send a blank email to php-general+get-5555@lists.php.net to get a copy of this message
I'm trying to open a directory and print out all files that have $id in the filename, but when I use the code below, I get "1 is not a Valid Resource" on the readdir line. The directory exists, and I think I'm calling it correctly. The weird thing is that it works about 15% of the time, but they rest it gives me this error. Any suggestions? Thanks in advance, John Fuetsch # Load Directory Into Array $dir = "images/thumbs"; $handle=opendir($dir); while ($file = readdir($handle)) { if(strstr($file,$id)) { $images[count($images)] = $file; } } # Clean up and sort closedir($handle); sort($images);

« previous php.general (#5555) next »