title: file_exists in PHP is not working as expected
body: <p>For the user's profile on my website they are allowed to upload 1 profile image. It can be PNG, JPG, JPEG, or GIF. Now my problem is displaying the images. Basically I would like to see what type of file extension it has, and then display the file accordingly. I am trying to achieve this with the <strong>file_exists</strong> function in PHP, but it does not seem to work! :(</p>
  
  <p>If I type the URL (uses .png for the example)</p>
  
  <blockquote>
    <p><a href="http://localhost/postin" rel="nofollow">http://localhost/postin</a>'/profiles/pictures/username.png</p>
  </blockquote>
  
  <p>into my URL bar it will display that user's image. Then if I type in the file path </p>
  
  <blockquote>
    <p>C:/wamp/www/postin'/profiles/pictures/username.png</p>
  </blockquote>
  
  <p>into the URL bar it will display that user's image. Now my problem is if I do PHP <strong>file_check</strong> on either of those it always says the file does NOT exist. Here is the code I am using: </p>
  
  <pre><code>&lt;?php
  
  $profileimagepath = "C:/wamp/www/postin'/profiles/pictures/";
  
  $profileimageurl = "http://localhost/postin'/profiles/pictures/";
  
  if (file_exists($profileimagepath.$username."."."png")) {   ?&gt;
      &lt;img src=&lt;?php $profileimageurl.$username."."."png"; ?&gt; id="accountpictureholderspecs"&gt;
  &lt;?php
  }
  elseif (file_exists($profileimagepath.$username."."."jpg")) {   ?&gt;
      &lt;img src=&lt;?php $profileimageurl.$username."."."jpg"; ?&gt; id="accountpictureholderspecs"&gt;
  &lt;?php
  }
  elseif (file_exists($profileimagepath.$username."."."jpeg")) {   ?&gt;
      &lt;img src=&lt;?php $profileimageurl.$username."."."jpeg"; ?&gt; id="accountpictureholderspecs"&gt;
  &lt;?php
  }
  elseif (file_exists($profileimagepath.$username."."."gif")) {   ?&gt;
      &lt;img src=&lt;?php $profileimageurl.$username."."."gif"; ?&gt; id="accountpictureholderspecs"&gt;
  &lt;?php
  }
  else {   ?&gt;
      &lt;img src="http://localhost/postin'/images/profileimage.png" id="accountpictureholderspecs"&gt;
  &lt;?php
  }   
  ?&gt;
  </code></pre>
  
  <p>And in the example above <strong>username</strong> is simply the user's username. So what I am wondering is why would this code not be working? Thank You!! :)</p>
  
  <p><strong>EDIT</strong>
  Here is my overall file path:</p>
  
  <pre><code>C:\wamp\www\postin'\profiles\pictures\image.png
  </code></pre>
  
  <p>Yet when I type in:</p>
  
  <pre><code>\pictures\image.png
  </code></pre>
  
  <p>It will not work, the image does not display! :(
  BTW, my directory structure:</p>
  
  <pre><code>Postin'
    Profiles
      Pictures
        image.png
  </code></pre>