Checking if files are there?
| From: | Sam | Date: | Wed, 24 Jan 2001 12:19:23 +0000 |
| Subject: | Checking if files are there? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-36400@lists.php.net to get a copy of this message | ||
Hi all,
I was wondering if you could use PHP to test if a picture is there?
I.E. checking if you could open the picture or not, and displaying a message
either way.
I have tried
$file = fopen ("../images/maps/$filename.jpg", "r");
if (!$file) {
print "This is no map for this trip.";
exit;
}
else
{
print "<img src=/images/maps/$filename.jpg>";
}
This works but also brings up a warning message as well, which is not
wanted.
Is there a way to get rid of the warning message?
Thanks in advance
Sam Rose