I'm having some trouble with glob in php and although I did some research, I just couldn't seem to find an answer to my problem.
First of all to my directory structure:
/ (root)
/images (folder)
- gallery/ (sub folder containing image files)
/pages (folder)
- gallery.php
I want to access the subfolder 'gallery' in the folder 'images'. So: In my gallery.php file I got the following line:
$images = glob("/images/gallery/*.*");
And this doesn't work.
What does work is, if I change the path to "../"
$images = glob("../images/gallery/*.*");
or if I change the code to:
define('BASE', $_SERVER['DOCUMENT_ROOT']);
$images = glob(BASE."/images/gallery/*.*");
Unfortunatly the sourcecode then shows some info I'm not sure I want to actually make public
e.g.
/home/scecjwkh/htdocs/images/gallery/3.JPG
I hope the information I provided is enough to actually understand my problem. Not sure why I have so much trouble with a relative path o.O
Thank you in advance, Stuben