trinistorm Posted December 13, 2009 Share Posted December 13, 2009 Does any one know how to change the directory fopen and similar methods operate in?This is my code: $reader = fopen("counter.txt", "rb");//Opens input stream for the counter file.$flag = fread($reader, 100);fclose($reader); However when i change fopen("counter.txt", "rb"); to fopen("C:/sites/counter.txt", "rb"); it still operates only in the folder the program is in. Link to comment Share on other sites More sharing options...
Redroest Posted December 13, 2009 Share Posted December 13, 2009 Well, I guess that this depends in some way of the configuration of the server. I guess that the server will not allow you to visit files outside its given root dir. this means that if your server has root: "C:/server/httpdir/". You cannot go to: "D:/files/counter.txt" or "C:/programs/counter.txt" Link to comment Share on other sites More sharing options...
trinistorm Posted December 14, 2009 Author Share Posted December 14, 2009 Ah thanks for your contribution. I found a solution on the php manual website; basically i just use the forward slash and escape it ie: "//" instead of "\"Php websiteThanks again. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.