Re: Invalid directory resource
| From: | (Richard Lynch) | Date: | Thu, 13 Jul 2000 01:50:19 +0000 |
| Subject: | Re: Invalid directory resource | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-6353@lists.php.net to get a copy of this message | ||
In article <000a01bfe912$c9c865a0$90c864ce@john>, terranlune@yahoo.com
("John Fuetsch") wrote:
> 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?
Try giving the full pathname to $dir.
> # Load Directory Into Array
>
> $dir =3D "images/thumbs";
>
> $handle=3Dopendir($dir);
> while ($file =3D readdir($handle)) {
>
> if(strstr($file,$id)) {
> $images[count($images)] =3D $file;
> }
>
> }
> # Clean up and sort
> closedir($handle);
> sort($images);
>
> ------=_NextPart_000_0007_01BFE8D8.1B62C120--
>
>
>
> __________________________________________________
>
> Do You Yahoo!?
>
> Talk to your friends online with Yahoo! Messenger.
>
> http://im.yahoo.com
--
Richard Lynch | If this was worth $$$ to you, buy a CD
US Customer Support Director | from one of the artists listed here:
Zend Technologies USA | http://www.L-I-E.com/artists.htm
http://www.zend.com | (this has nothing to do with Zend,
duh!)