Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Absolute filesys path to relative url path

Status
Not open for further replies.

Sleidia

Technical User
May 4, 2001
1,284
FR

Hi :)

How do you translate an absolute filesystem path ( D:/root/dir1/ ) into a relative url ( ../../dir1/ ) ?

Thanks ;)
 
i don't think that's straightforward.

i'd probably take the realpaths of the current directory (__DIR__) and the absolute path you're testing and then compare the two.

then, having got the comparison, compare the resultant to the current $_SERVER['DOC_ROOT']

here is a link which should give you a pseudo code for achieving this

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top