Re: Help with CHdir

From: Date: Wed, 02 Oct 2002 19:50:36 +0000
Subject: Re: Help with CHdir
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-118647@lists.php.net to get a copy of this message
Your code makes no sense and the error message is telling you exactly what you did wrong. opendir() returns a directory handle to be passed to readdir(). Calling chdir() on a directory handle makes no sense. You want to chdir to the same string that you passed to opendir() -Rasmus On Wed, 2 Oct 2002, Nokar wrote: > I get this error from php when i execute this code can you help me ;) > Warning: chdir() expects parameter 1 to be string, resource given in > C:\xxxx\read.php on line 146 > > 145 echo "<center>Attachment :"; > 146 $rep = opendir("C:\\xxx\\Attach\\$id\\"); > 147 chdir($rep); > 148 while ($zone = readdir($rep)) > 149 { > 150 if (!is_dir($zone)) echo "<a > href=\"../Attach/$id/$zone\">$zone</a><br>"; > 151 } > 152 echo "</center>"; > 153 } > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.general (#118647) next »