I am trying to redirect if working.php is present in folder other wise echo no file.
this script only echo's no file.
thanks.

<?php
$filename = 'working.php';
if(file_exists('$filename'))
{
 header( 'Location: welcome.php' ) ;
}
else
{
echo "NO FILE";
}
?>

Hey I just tried your script, it didn't work for me so I changed it and this works:

<?php
$filename = 'file.php';
if(file_exists($filename))
{
 header( 'Location: welcome.php' ) ;
}
else
{
echo "NO FILE";
}
?>

@phorce: Good spot. Single quoted strings do not do variable substitution. So it was actually looking for a file named $filename

yes !!
once again phorce has saved me.
thank you.
not sure how i missed that.
any ideas to have the script auto reshresh after ?

header( 'Location: welcome.php' ) ;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.