So I'm trying to make a dynamic link page that takes a load of entries, links to an image if it exists, and links to an upload box if it doesn't. For some reason, though, when I pass a variable to file_exists it returns false, even if passing the same location directly returns true. For example:
$tempcomp = "dogs/big dogs/misty.puppy.jpg";
if (file_exists($tempcomp))
{
echo "YES1";
}
clearstatcache();
if (file_exists ("dogs/big dogs/misty.puppy.jpg"))
{
echo "YES2";
}
clearstatcache();
This code returns YES2, even though both statements are identical. What causes this kind of behavior?