I am trying to use a relative path to access my folders on the webserver.
Basically, i need to be able to read any subfolder under folder MAIN and echo its contents. I am able to do this if my path is static like c:\php\blah\blah. What i need is to use the webserver directories from my isp which only give me 'public_html' as the first folder (no root)

Thanks for your response....but i think I forgot to mention that I want to access the directories file names only.. that is why i didn't specify the file. Basically, I want to loop through the directory (i know how to do that..I Think ), but first I need to be able to open the directory.. MAYBE fopen is not the function i am looking for??

Firstly, when you're accessing a file via it's web address, realise that you're calling it through HTTP and thus will only have HTTP access (ie, if you call your PHP file through the web address, you will only get the outputted contents, not the file coding itself).

Directories on the server on normally lower down in the directory structure. You can use print_r($_SERVER) to list all the server variables, one of them will show the full path root. Use this to open directories and files, it won't matter where it's being called from because it's an absolute link!

Jay wrote:Firstly, when you're accessing a file via it's web address, realise that you're calling it through HTTP and thus will only have HTTP access (ie, if you call your PHP file through the web address, you will only get the outputted contents, not the file coding itself).

Directories on the server on normally lower down in the directory structure. You can use print_r($_SERVER) to list all the server variables, one of them will show the full path root. Use this to open directories and files, it won't matter where it's being called from because it's an absolute link!

Thanks Jay, I was able to get the absolute path.
Now I have to figure out how to read all the fileNAMES in the given directory.