Check if files exists
With this short codesnippet you can easily check if a file exists on your server.
$filename = '/path/to/foo.txt';
if (file_exists($filename)) {
print "The file $filename exists";
} else {
print "The file $filename does not exist";
}
?>
March 10th, 2006 at 9:12 am
I add an error doc to this script instead of printing the result and it worked great.
Thanks.
June 26th, 2006 at 1:55 pm
I need a short code to check before an image is loaded if the file exists on th server.
If it does, the image will be loaded. (the fuks name is stored in a javascript variable rt)
If it does not, another image name “nopic.jpg” will be loaded.
How do I do it?
I have no knowlage with PHP.
PLease help.
June 26th, 2006 at 1:57 pm
OOps, type missmatch….should have been the FILE name in stored…
Sorry.