file_exists() returns false, but the file DOES exist
Results of the file_exists()
are cached, so try using clearstatcache()
. If that not helped, recheck names - they might be similar, but not same.
file_exists()
just doesn't work with HTTP addresses.
It only supports filesystem paths (and FTP, if you're using PHP5.)
Please note:
Works :
if (file_exists($_SERVER['DOCUMENT_ROOT']."/folder/test.txt")
echo "file exists";
Does not work:
if (file_exists("www.mysite.com/folder/test.txt")
echo "file exists";