views:

474

answers:

1

I know $_SERVER['DOCUMENT_ROOT'] returns the document root (most likely something like /home/user/public_html), but is there any way to get the parent directory of this folder? (i.e. just /home/user/)

I would try and replace common folder names like public_html or www, but it's not a given that the folder would be named that on all systems I want this code to run on.

FYI: I'm trying to implement this, but i want the user to be able to select their FTP root folder, which is most commonly the parent of the Document Root folder.

Any thoughts?

+1  A: 
dirname($_SERVER["DOCUMENT_ROOT"]);
Typeoneerror
Thanks for your quick help!
Andrew E.