Possible Duplicate:
How can one check to see if a remote file exists using PHP?
Check if file exists on remote machine
I'm having trouble with this code. I'm trying to search for a file in $url
below, and the file does exist, but the code is returning No files located here
instead. I either have the wrong syntax or I'm not able to search for a file in this manner.
Please help. Thanks in advance.
<?php
function formaction()
{
$url = "http://".$_SERVER['HTTP_HOST'] . "/" . basename(dirname (dirname (dirname (dirname
(__FILE__))))) . "/process.php";
$path = false;
if (@file_exists($url))
{
$path = $url;
}
else
{
echo "No file located here";
}
return $path;
}
echo formaction();
?>