note 36209 added to function.file-exists

From: Date: Wed, 01 Oct 2003 07:30:39 +0000
Subject: note 36209 added to function.file-exists
Groups: php.notes 
Request: Send a blank email to php-notes+get-57518@lists.php.net to get a copy of this message
My working Windows directory is c:\Program Files\Apache Group\Apache2\htdocs, I have some scripts /app/mr/main.php where I use function file_exists(). When I need to check existens of some file in /app/mr/ or some subdirectory of /app/mr/ then file_exists() work well, but if I need to check existens in some other directory, for example in my case, to check existence of /app/art/CheckedFile.jpg then this code dosn't work $filename = "/app/art/CheckedFile.jpg"; if (file_exists($filename)) {echo $filename." exists";} else {echo $filename." not exists";} but this work well $winDir = "c:/Program Files/Apache Group/Apache2/htdocs"; $filename = "/app/art/CheckedFile.jpg"; if (file_exists($winDir.$filename)) {echo $filename." exists";} else {echo $filename." not exists";} if you specify relative path for checked file then file_exists() works well only if checked file is at same directory or subdirectory of calling script directory, otherwise you should specify absolute path for checked file. ---- Manual Page -- http://www.php.net/manual/en/function.file-exists.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+36209 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+36209&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+36209&report=yes

« previous php.notes (#57518) next »