note 78843 deleted from function.file-exists by felipe
| From: | felipe@php.net | Date: | Sun, 16 Dec 2007 11:19:40 +0000 |
| Subject: | note 78843 deleted from function.file-exists by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-133656@lists.php.net to get a copy of this message | ||
Note Submitter: thuy
----
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
}