PHP - Check if file exists without knowing the extension -


i saw this question, didn't work me.

what need check whether file exists, in php, without knowing extension. use code:

<?php  if (count(glob("/database/".$_request['thetitle'].".*")) == 0) { echo 'true'; } else { echo 'false'; } ?> 

edit: maybe it's relevant saying script located in

[root]/functions/validatefilename.php 

and database in

[root]/database/ 

but returns false, no matter filename ($_request['thetitle']) is.

try:

count(glob("./database/".$_request['thetitle'].".*")) 

Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -