monkeytooth Posted January 8, 2010 Share Posted January 8, 2010 if(file_exists($_SERVER['DOCUMENT_ROOT'].'/img/'.$file2check)) I am not understanding whats wrong with this. The images are stored in a subdirectory inside of the root www/img/ the script is in /www/ ive tried this a number of ways but its not finding the file. Files does exisit spelling is correct, case sensitive matches accordingly. but it just don't work.. im confused. Quote Link to comment https://forums.phpfreaks.com/topic/187692-file-exists-directory-issue/ Share on other sites More sharing options...
PHP Monkeh Posted January 8, 2010 Share Posted January 8, 2010 Have you tried echo-ing $_SERVER['DOCUMENT_ROOT'] to see what it produces? You may not be getting the expected result. Quote Link to comment https://forums.phpfreaks.com/topic/187692-file-exists-directory-issue/#findComment-990877 Share on other sites More sharing options...
monkeytooth Posted January 8, 2010 Author Share Posted January 8, 2010 Echoing out doc_root, I have done, and then I applied that to what I was trying to do and still got nothing. And I have tryed echoing out the same thing in an image tag, and the image displays, but the file exists returns as not found. Quote Link to comment https://forums.phpfreaks.com/topic/187692-file-exists-directory-issue/#findComment-991186 Share on other sites More sharing options...
PFMaBiSmAd Posted January 8, 2010 Share Posted January 8, 2010 You probably have some non-printing characters in $file2check. Does using var_dump() on $file2check produce an expected length that matches the visible characters? Quote Link to comment https://forums.phpfreaks.com/topic/187692-file-exists-directory-issue/#findComment-991231 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.