Simple Php problem about scandir

Hi, everyone.

I got a problem in php as i don't really know too much php.

My situation is:
My pictures in> "/site/pic/" e.g. "/site/pic/a.jpg"
My php programs in >"/site/phpfile" e.g.  "/site/phpfile/testing.php"

OK, now i want to use testing.php to list the files name from /site/pic/ e.g. a.jpg, b.jpg

My code is:
$dir = "/site/pic"
$pics = scandir($dir);

but the scandir doesn't work. How can i scandir the folder when it is upper folder?

Thank you

If i put php and image in the same folder, it will work.

$dir = "."
$pics = scandir($dir);

So i am wondering...how can i do the structure like that.

[ 本帖最後由 Butt 於 2008-12-31 08:46 編輯 ]

TOP

原帖由 Butt 於 2008-12-31 08:43 發表
If i put php and image in the same folder, it will work.

$dir = "."
$pics = scandir($dir);

So i am wondering...how can i do the structure like that.


I guess it is the problem of web server or php setting.
It may do something on security.

TOP

try "../pic/"

TOP

../ does work.

TOP