note 19940 deleted from function.md5-file by nlopess
| From: | nlopess@php.net | Date: | Sun, 12 Sep 2004 17:52:41 +0000 |
| Subject: | note 19940 deleted from function.md5-file by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-76547@lists.php.net to get a copy of this message | ||
Note Submitter: dpiper at stens dot com
----
Since I am running PHP4.1.2 and the md5_file is not included yet in the source code, here is a
binary safe PHP-code function to do the same thing if anyone else wants it:
This function is:
function md5_of_file($inFile) {
if (file_exists($inFile)) {
$fd = fopen($inFile, 'r');
$fileContents = fread($fd, filesize($inFile));
fclose ($fd);
return md5($fileContents);
} else {
return false;
}
}