Re: chdir() help
| From: | mike cullerton | Date: | Sat, 07 Jul 2001 15:42:26 +0000 |
| Subject: | Re: chdir() help | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-56640@lists.php.net to get a copy of this message | ||
i believe the script considers it's own directory as it's current working
directory.
try calling the files by image/$file_name
on 7/7/01 9:38 AM, McShen at hshen@crosswinds.net wrote:
> hi
>
> 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
>
> -------
> <?php
>
>
> $dir_name = "e:\work";
> $dir = opendir($dir_name);
> while ($file_name=readdir($dir)) {
>
> if (($file_name!="." && $file_name!="..")) {
> echo $file_name."\n ";
>
> if (chdir('e:\work\image')) {
> echo "current dir is e:\work\image";
> }
> echo "<IMG SRC=$file_name>";
> }
> }
> closedir($dir);
> ?>
> -----
>
> Please help me to fix the problem. Thanks.
>
-- mike cullerton