I would like to hash the contents of an uploaded file in MD5. The file will not be saved locally so it only exists in a tmp directory.
How can I do this? Thanks.
You can use md5_file()
or sha1_file()
function. For example, if your post variable is filevar
:
$myhash = md5_file($_FILES['filevar']['tmp_name']);
You can use md5_file()
, even on your temporary file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With