md5_file – PHP String Functions
Syntax :
Description :
The md5_file() function calculates the MD5 hash of a file.
The md5_file() function uses the RSA Data Security, Inc. MD5 Message-Digest Algorithm.
Use the md5() function to calculate the MD5 hash of a string.
Parameter :
[table caption=”” width=”100%” colwidth=”15%|15%|15%|55%” colalign=”left|lef|lef|left”]
Name, Required /Optional, Value Type, Description
Filename , Required, String , It is the name of the file.
Raw_output, Optional, Boolean, When TRUE it returns the digest in raw binary format with 16 characters length. By default its FALSE returns 32 characters hex number.
[/table]
Output :
This will returns a MD5 hash on success, otherwise FALSE.
ChangeLog :
[table caption=”” width=”100%” colwidth=”25%|75%” colalign=”left|left”]
Version, Description
PHP 5.1.0 , Changed the function to use the streams API. It means that you can use it with wrappers like md5_file(‘http://example.com/..’)
[/table]
Related articles : md5(), sha1_file(), crc32().
md5_file() – PHP Functions Example 1 :
<?php $filename = 'sample.zip'; //any file name which you want to specify for md5 hash echo 'MD5 file hash of ' . $file . ': ' . md5_file($file); ?>