jack5100nv Posted March 10, 2010 Share Posted March 10, 2010 I am using the file_exists() function to check if the file exists before including it but it always returns false If I take out the file_exists function, I can see that the include function includes the file correct without any errors. Here is the code. what am I doing wrong? $languagefilename = "language/english.php"; if (is_readable($languagefilename)) include($languagefilename); else echo("<br><center><b>The file for selected language is missing from the Language folder</b></center><br>"); Quote Link to comment https://forums.phpfreaks.com/topic/194837-using-file_exists-function-always-return-false-even-if-the-file-exists/ Share on other sites More sharing options...
jack5100nv Posted March 10, 2010 Author Share Posted March 10, 2010 I mean the code is $languagefilename = "language/english.php"; if (file_exists($languagefilename)) include($languagefilename); else echo("<br><center><b>The file for selected language is missing from the Language folder</b></center><br>"); Quote Link to comment https://forums.phpfreaks.com/topic/194837-using-file_exists-function-always-return-false-even-if-the-file-exists/#findComment-1024480 Share on other sites More sharing options...
roopurt18 Posted March 11, 2010 Share Posted March 11, 2010 You're using relative paths which means "language/english.php" probably does not exist from the point you're asking for it. Quote Link to comment https://forums.phpfreaks.com/topic/194837-using-file_exists-function-always-return-false-even-if-the-file-exists/#findComment-1024536 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.