You may also want to check that it's a file (not a directory or special file), and that it's readable and writeable. Try:
if (-e "$ENV{REMOTE_ADDR}.$ENV{HTTP_COOKIE}.txt") { if (-f _) { if (-r _) { if (-w _) { #Do stuff here } else { #Not writable } } else { #Not readable } } else { #Not a file } } else { #Doesn't exist }
You can put all the checks in the one if by anding them if you only need to check that the file exists and is accessable.
Colin ScottIn reply to Re: If File Exists
by cds
in thread If File Exists
by damian
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |