I already saw this question, but it didn't work for me.
What I need to do is to check whether a file exists, in PHP, without knowing the extension. I use this code:
<?php
if (count(glob("/database/".$_REQUEST['thetitle'].".*")) == 0) {
echo 'true';
} else {
echo 'false';
}
?>
EDIT: Maybe it's relevant saying that the script is located in
[root]/functions/validatefilename.php
and the database in
[root]/database/
But it always returns false, no matter what the filename ($_REQUEST['thetitle']
) is.
try:
count(glob("./database/".$_REQUEST['thetitle'].".*"))