tags:

views:

36

answers:

2

Hello. I'm trying to make a small script that's changing the permission for specific file using a ftp connection. My problem is the absolute path. I have a ftp account wich land on the script directory (/script/). If i'm using getcwd, it will return the whole path (/home/user/public_html/script) but i need only the difference between the full path and the current path (getcwd path: /home/user/public_html/script/ ftp landing path: /script). So, how can i use getcwd to get the current directory for a ftp account? For example, if the user is landing in public_html, the path to the script will be /script/, or if he is landing inside /user, the path will be /public_html/script. Thanks

A: 

The getcwd call will only work for your local system. You need to program the logic to do the difference.

xyld
Any idea from where to start?
John Doe
A: 

In your script, you should do a:

var_dump($_ENV);

And check if there is a variable which will help you in conjunction with getcwd(). Then you can do some string work on both results to get the path you need.

analogue