Re: file_exists problems
| From: | David Robley | Date: | Wed, 13 Sep 2000 02:15:14 +0000 |
| Subject: | Re: file_exists problems | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-16472@lists.php.net to get a copy of this message | ||
On Wed, 13 Sep 2000, Kurth Bemis wrote:
> i can get this to work....and i have no idea why..
>
> $model = "/tvhc/homes/stonecreek/" .$model. ".jpg";
>
> if(!file_exists($model)){
> print" <img src=\"$model\" border=\"0\"
> alt=\"\"><br> ";
> }else{
> print" <img src=\"/tvhc/homes/stonecreek/nothere.jpg\" border=\"0\"
>
> alt=\"\"><br> ";
> }
>
> it should check to see if the file exists and if it does display that
> model..if not it should display a images saying that the model that you
> requested hasn't been posted yet...blah, blah.....
>
> can anyone tell me where i'm going wrong?
>
> ~kurth
Your logic seems a little shaky :-) I read that as :
if (not exist file $model)
display file $model
else (if it does exist)
display other file
and as has been pointed out you are using an absolute path instead of a
docrooted path to display the image.
--
David Robley | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/
AusEinet | http://auseinet.flinders.edu.au/
Flinders University, ADELAIDE, SOUTH AUSTRALIA