title: PHP file_exists() says existing file does not exist
body: <p>I'm trying to check if an XML file exists, depending on a username parameter</p>
  
  <pre><code>&lt;?php
  $username = $_GET["username"];
  $filename = "/documents/$username/data.xml";
  
  if (file_exists($filename)) {
     // output documents
  } else {
     echo "No documents exist in your account.";
  }
  ?&gt;
  </code></pre>
  
  <p>It continues to return that the file doesn't exist.</p>
  
  <p><strong>Full path:</strong> <a href="http://example.com/documents/" rel="nofollow noreferrer">http://example.com/documents/</a>{username}/data.xml</p>
  
  <p><em>Why does it continue to return false when I know the file exists?</em></p>
  
  <blockquote>
    <p>EDIT: I made this post years ago, this is definitely not the best way to keep user data, but the answers to this post serve as good explanations of file_exists().</p>
  </blockquote>