dflow Posted April 6, 2009 Share Posted April 6, 2009 i have this script: <?php $filename = 'http://website.com/images/logo.gif'; if (file_exists($filename)) { echo "The file $filename exists"; } else { echo "The file $filename does not exist"; } ?> i get the else result echoed although the image exists any ideas? Link to comment https://forums.phpfreaks.com/topic/152788-file-exists-function-returning-wrong-result/ Share on other sites More sharing options...
gffg4574fghsDSGDGKJYM Posted April 6, 2009 Share Posted April 6, 2009 Read : http://www.php.net/manual/en/function.file-exists.php as some people already posted some code workaround for file_exists() (with URL) to work with older php version. Some with cURL, get_headers() or fsockopen(). New php version >= 5.0.0 seem to natively support http protocol with file_exists() function though i never try that. I always used file_exists() only for local file and a home made version for testing URL. Link to comment https://forums.phpfreaks.com/topic/152788-file-exists-function-returning-wrong-result/#findComment-802328 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.