Re: file_exists() returns incorrect result
| From: | Philip Olson | Date: | Thu, 04 Jan 2001 19:39:48 +0000 |
| Subject: | Re: file_exists() returns incorrect result | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-32691@lists.php.net to get a copy of this message | ||
Ahh, that is a better file_exists test. But after starting the post it
was realized that the issue is the location of the images directory and
not specifically a file_exists issue.
Philip
On Thu, 4 Jan 2001, Cynic wrote:
> what about
>
> if( file_exists( __FILE__ ) {
> echo "YES\n" ;
> } else {
> echo "NO\n" ;
> }
>
> if this fails there's surely something rotten.
>
> At 20:07 4.1. 2001, Philip Olson wrote the following:
> --------------------------------------------------------------
>
> >Do a simple test. Locate a file you know exists and check for it.
> >
> > if (file_exists($file)) {
> >
> > print 'YES!';
> >
> > } else {
> >
> > print 'NO.';
> >
> > }
> >
> >And be sure to define $file as an existing file and be sure it exists
> >within the assigned directory. You are doing :
> >
> > /images/...
> >
> >Within your html page that *would* be correct as :
> >
> > example.com/images/...
> >
> >But this is not the case here, you are checking for existance of file on
> >webserver so depending in setup it may check :
> >
> > /images/...
> >
> >Rather then something like :
> >
> > /home/username/sup/www/images/...
> >
> >And it will not exist there. Be sure to check the path, perhaps changing
> >/images/ to images/ will work.
> >
> >
> >Regards,
> >
> >Philip Olson
> >http://www.cornado.com/
> >
> >
> >On Thu, 4 Jan 2001, Michal Hrtko wrote:
> >
> >> Hello,
> >>
> >> in my code I've written
> >> ...
> >> $prjid =
> >> "/images/".strtolower($HTTP_COOKIE_VARS["ckprj"]).".gif";
> >> if (file_exists($prjid)) echo "<IMG SRC=\"$prjid\"
> >> BORDER=0>\n";
> >> ...
> >>
> >> file_exists() returns false, even if file in $prjid really exists in
> >> local system.
> >> Is there mistake in string format, or php-module should have any
> >> non-standard setting?
> >> I welcome any advice. My configuration, if needed is PHP 4.0.3, Apache
> >> 1.3.14 with SSL.
> >>
> >> Michal.
> >>
> >>
> >> --
> >> PHP General Mailing List (http://www.php.net/)
> >> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> >> For additional commands, e-mail: php-general-help@lists.php.net
> >> To contact the list administrators, e-mail: php-list-admin@lists.php.net
> >>
> >
> >
> >--
> >PHP General Mailing List (http://www.php.net/)
> >To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> >For additional commands, e-mail: php-general-help@lists.php.net
> >To contact the list administrators, e-mail: php-list-admin@lists.php.net
> ------end of quote------
>
>
>
> ____________________________________________________________
> Cynic:
>
> A member of a group of ancient Greek philosophers who taught
> that virtue constitutes happiness and that self control is
> the essential part of virtue.
>
> cynic@mail.cz
>
>