I'm not sure I know exactly what you want, as the script isn't clear on its
purpose. If you simply want to print out all the images in e:\work\image,
and nothing else, the code would be much simpler.

$dir = opendir("e:/work/image");
while ($file_name=readdir($dir)) {
    if ($file_name <> "." && $file_name <> "..") {
        echo "<img src='image/$file_name'>";

/* Chris Lambert, CTO - [EMAIL PROTECTED]
WhiteCrown Networks - More Than White Hats
Web Application Security - www.whitecrown.net

----- Original Message -----
Sent: Saturday, July 07, 2001 11:38 AM
Subject: [PHP] chdir() help


Currently, i am working in e:\work, and there is a folder named "image"
under e:\work, so, the path to image is e:\work\image.

I have a script under e:\work, and i wanna display all images under the
folder e:\work\image, I use chdir() to change the directory. but it wouldn't
work. it still displays the images under e:\work. Why is that? Does chdir()
work under win2k pro? here is my script


$dir_name = "e:\work";
$dir = opendir($dir_name);
while ($file_name=readdir($dir)) {

 if (($file_name!="." && $file_name!="..")) {
  echo $file_name."\n&nbsp;&nbsp;";

  if (chdir('e:\work\image')) {
   echo "current dir is e:\work\image";
  echo "<IMG SRC=$file_name>";

Please help me to fix the problem. Thanks.

PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to