I have a strange problem with testing file_exists.
When I hardcode the file name 007-PCSafety.zip file_exists works fine but when I post the filename 007-PCSafety.zip it doesn't recognise the file exists.
here's the code. I'm swapping the $p variable to test.
if($_POST){
$url = $_POST['dl'];
$filename = basename($url).PHP_EOL;
$p=$filename;
//$p="007-PCSafety.zip";
if(file_exists($p)){
echo $p.' File already exists.<br><form method=post action="exists.php"><input type=text name=dl value=""><input type=submit></form>';
} else
echo $p.' File does not exist.<br><form method=post action="exists.php"><input type=text name=dl value=""><input type=submit></form>';
}