I am using this:
echo dirname(__FILE__);
which gives:
C:\UwAmp\www\myfolder\admin
However I am looking for path until:
C:\UwAmp\www\myfolder\
from current script. How can that be done ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You could do either:
Or:
…but in a web server environment you will probably find that you are already working from current file’s working directory, so you can probably just use:
…to reference the directory above. You can replace
__DIR__withdirname(__FILE__)before PHP 5.3.0.You should also be aware what
__DIR__and__FILE__refers to:So it may not always point to where you want it to.