Re: file checking
| From: | Erik Stainsby | Date: | Sat, 24 Jun 2000 04:30:52 +0000 |
| Subject: | Re: file checking | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-2890@lists.php.net to get a copy of this message | ||
One point that should be mentioned that seems to have been
missed so far is that you are opening a connection to the
http: service on the remote server.
Regardless of whether the particular file you request is there
or not, the service and the webserver will return some text to
the fopen() call.
Even a non-existent target will register some level of success
for the fopen() call.
Is it possible this is what your code is tripping over ?
best of luck, Erik
----- Original Message -----
From: "Topher" <topher@wcsg.org>
To: <php-general@lists.php.net>
Sent: Friday, June 23, 2000 11:48 AM
Subject: [PHP-GENERAL] file checking
> Here's my code:
>
> $fp = fopen(
>
> "http://media.gospelcom.net/mnn/news/2000/06/44-5min-23-06-2000.mp3,
> "r");
>
> if ($fp)
> print "It's there";
> } else
> print "It's not there";
> }
>
> If the file exists, it works fine, but if it *doesn't* exist, it prints
> this:
>
>
> Warning:
>
fopen("http://media.gospelcom.net/mnn/news/2000/06/44-5min-23-06-2000.mp3","
r")
> - Success in /usr/local/www/gospelcom/docs/mnn/mnn/beta/remotetest.php on
> line 5
> It's not there
>
>
> Why is it printing that Warning?
>
> I tried is_file and is_readable, and both return that the file isn't not
> there, regardless of whether it is. :(
>
>
> --
> Topher
> Manager of Internet Services
> Cornerstone Communications
>
>
> --
> 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
>