file_exists() returns false, but the file DOES exist

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";

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)