note 78843 added to function.file-exists
| From: | thuy at osu1 dot php dot net | Date: | Tue, 30 Oct 2007 20:00:22 +0000 |
| Subject: | note 78843 added to function.file-exists | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-131832@lists.php.net to get a copy of this message | ||
This solution works for me. Just need to fix a typo in the original post:
$fileUrl = "http://www.examplecom/test.jpg";
$AgetHeaders = @get_headers($fileUrl);
if (preg_match("|200|", $AgetHeaders[0])) {
// file exists
} else {
// file doesn't exists
}
-------------------------------------------------------------
Posted by:
florinel2k at yahoo dot com
13-Jun-2007 01:23
This is an example if you want to know that a file exists (if that file isn't on your server):
$fileUrl = "http://www.examplecom/test.jpg";
$AgetHeaders = @get_headers($sourcePath);
if (preg_match("|200|", $AgetHeaders[0])) {
// file exists
} else {
// file doesn't exists
}
----
Server IP: 69.147.83.197
Probable Submitter: 76.88.50.241
----
Manual Page -- http://www.php.net/manual/en/function.file-exists.php
Edit -- https://master.php.net/note/edit/78843
Del: integrated -- https://master.php.net/note/delete/78843/integrated
Del: useless -- https://master.php.net/note/delete/78843/useless
Del: bad code -- https://master.php.net/note/delete/78843/bad+code
Del: spam -- https://master.php.net/note/delete/78843/spam
Del: non-english -- https://master.php.net/note/delete/78843/non-english
Del: in docs -- https://master.php.net/note/delete/78843/in+docs
Del: other reasons-- https://master.php.net/note/delete/78843
Reject -- https://master.php.net/note/reject/78843
Search -- https://master.php.net/manage/user-notes.php