I'm trying to check if an XML file exists, depending on a username parameter
<?php
$username = $_GET["username"];
$filename = "/documents/$username/data.xml";
if (file_exists($filename)) {
// output documents
} else {
echo "No documents exist in your account.";
}
?>
It continues to return that the file doesn't exist.
Full path: http://example.com/documents/{username}/data.xml
Why does it continue to return false when I know the file exists?
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().