file_exists($path), $path - path to the file, on the local machine. $TmpName=/images/file1.jpg;
file_exists($DOCUMENT_ROOT.$TmpName); $DOCUMENT_ROOT - PHP environment variable, containing the root path
to website documents on the server machine, and $TmpName - path to the file you checking relative to website root
path. $File="file1.jpg";
$TmpName="/images/".$File;
if(file_exists($DOCUMENT_ROOT.$TmpName)){
print "<b> Oops! The file named
$File already exists</b>";
} else{
print "<b> File named
$File does not exist </b>";
}
When you are usually have to check a file for existence: If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.