note 76545 deleted from function.file-exists by cmb
| From: | cmb@php.net | Date: | Sun, 29 Sep 2019 07:15:13 +0000 |
| Subject: | note 76545 deleted from function.file-exists by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-212382@lists.php.net to get a copy of this message | ||
Note Submitter: worldclimb at gmail dot com
----
Small error in florinel2k's example
$sourcePath should be $fileUrl, otherwise it works well for me.
//Corrected
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($fileUrl);
if (preg_match("|200|", $AgetHeaders[0])) {
// file exists
} else {
// file doesn't exists
}