I trying to fopen a dir in Users dir ("C:\Users\MYUSERNAME\AppData\Roaming\SOFTWARENAME\") I trying do that from a php file that located in www dir (wamp folder in C). This is my try:
$file = fopen('../../../Users/Myusername/AppData/Roaming/SOFTWARENAME/', 'r');
I get "failed to open stream: No such file or directory".
Help?
Thank and sorry for my english.
I think its generally considered a bad idea to try to access files outside of the root directory of the web application and it may even be completely blocked by php unless you turn off a security check.
But that being said, you can try to use an environment variable to get the full path.
Check out this api for example: $_ENV
So your code may look more like this:
$file = fopen($_ENV['HOMEDRIVE'] + $_ENV['HOMEPATH] + '/' + fileName, 'r');
I'm not sure whats in the environment exactly but those are common environment variables on windows.