RE: [PHP] file_exists problems

From: Date: Tue, 12 Sep 2000 15:56:15 +0000
Subject: RE: [PHP] file_exists problems
Groups: php.general 
Request: Send a blank email to php-general+get-16375@lists.php.net to get a copy of this message
> 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? I believe that your problem is that file_exists() requires an absolute path while the <img> tag uses a path relative to the website root directory. So unless they are one and the same, you are going to have to use and initialize 2 seperate variables - one for the absolute path and one for the relative path. Chris

« previous php.general (#16375) next »