Re: detect a file if it exist and display an image

From: Date: Fri, 17 Sep 2004 07:18:53 +0000
Subject: Re: detect a file if it exist and display an image
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-196942@lists.php.net to get a copy of this message
this might work. <?php $filename = '/path/to/foo.txt'; if (file_exists($filename)) { echo "The file $filename exists"; } else { echo "The file $filename does not exist"; } ?> On Fri, 17 Sep 2004 15:04:44 +0800, Louie Miranda <lmiranda@gmail.com> wrote: > im not sure if i coded one of my application wrong, i am displaying an > image by displaying the itemcode and just adding a ".jpg" extension at > the end. > > like this.. > > $itemCode = $row['itemCode']; > .. > <img src=/images/$itemCode.jpg> > > i assumed before that i can show it all, but i found out that i cannot. > > my problem now is the $itemCode is on a database and the image > filename is on directory. > Will it be possible to detect a image file it exist or not? > > -- > Louie Miranda > http://www.axishift.com > -- Louie Miranda http://www.axishift.com

« previous php.general (#196942) next »