Reputation:
In my webroot, i have a file called exists.php in which is this code to check if a file exists:
$filename = 'http://www.domain.nl/contact.php';
if (file_exists($filename))
{
echo "Document ".$filename." found...<br><br><br>";
}
else
{
echo "Document ".$filename." not found...<br><br><br>";
};
The file contact.php DOES exist but when calling exists.php he echoes: Document not found
When changing code to this:
$filename = 'contact.php';
if (file_exists($filename))
{
echo "Document ".$filename." found...<br><br><br>";
}
else
{
echo "Document ".$filename." not found...<br><br><br>";
};
Then it echoes: Document found.
Why does this not work with an absolute path?
Upvotes: 0
Views: 207
Reputation: 212522
file_exists()
only works on stream wrappers that support the stat function.
These include:
http:// is not supported
Upvotes: 3