Re: [PHP] Checking for existence of file

2003-03-25 Thread Jason Wong
On Wednesday 26 March 2003 03:12, Verdon Vaillancourt wrote:

 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.

is_file()

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Happiness is just an illusion, filled with sadness and confusion.
*/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Checking for existence of file

2003-03-25 Thread CPT John W. Holmes
 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.

Maybe you can start with file_exists() or is_file() and somehow work from
there???

---John Holmes...


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php