To determine whether a file exists on the server, PHP has a simple function: file_exists.
<?php
$filename = '/optional/path/file.txt';
if (file_exists($filename)) {
echo "The file $filename exists";
} else {
echo "The file $filename does not exist";
}
?>