Checking for existence of file
| From: | Verdon Vaillancourt | Date: | Tue, 25 Mar 2003 19:12:15 +0000 |
| Subject: | Checking for existence of file | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-140988@lists.php.net to get a copy of this message | ||
HI :)
I've got a function (crude but works) that checks for a value in the url and
then I call an image based on that value.
if (isset($_GET['menu'])) {
$img_pick = substr($_GET['menu'],0,1);
} else { $img_pick = "1"; }
echo "<img src=\"/images/mast_$img_pick.jpg\">";
What I'd like to do is check the directory 'images' first to see if
'mast_$img_pick.jpg' exists and if it doesn't, call a different image such
as 'mast_default.jpg'. I'm sure this isn't hard, I'm just not sure how to
start.
TIA, verdon
Ps. Please cc me if replying to list