PHP if file exists
<p>Here is my code.</p>

<pre><code>$filename = "$myMedia catalog/category/ $myImage.png";
$filename = str_replace(" ", "", $filename);

if (file_exists($filename)) {
    echo "The file $filename exists";
} else {
    echo "The file $filename does not exist";
}
</code></pre>

<p>The <code>variable</code> above outputs <code>http://50.87.6.244/~storeupp/media/catalog/category/Game_Used.png</code> which does exist. However, it says that it does not exists.</p>

<p>Any idea why?</p>
