Click here to Skip to main content
15,935,429 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a opensource script im modifying...
It contains php and javascript. My problem is:

The script/app is tiny and when a user registers on my site the script is loaded into a folder that is created with the users name. I dont know the username of the person so i dont know the folder name...(or path to file).

The php side of the script i used the following 2 lines of code to determine the files url and path to its parent folder.

$config[path] = $_SERVER[DOCUMENT_ROOT;].substr(dirname(__FILE__),strlen($_SERVER[DOCUMENT_R;])); //this gives releltive url without trailing  / 
$config[url] = tp://'http://'.$_SERVER[SERVER_NAME].dirname($_SERVER[REQUEST_URI]); // this works perfectly..

The above examples work like this: They out put the url to the folder name:
IE: or no"/"..

I call this the path to parent folder of an unknown file position ur and path..

HOW DO I DO THIS WITH JAVASCRIPT? Im trying to output an url to this files location not the file itself...  and im looking for a result like this:  with or without the trailing /..... i can just add this to the include file links prefix...

The big thing to know, i dont know the username folder..
Please help..

1 solution

not possible - your only able to see the servername etc, cos they let you. too much of a security risk to show all. you could try using google to search the parent directory but it probally wont let you do that either. :P
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900