PHP - hash of the uploaded file

I would like to hash the contents of the downloaded file in MD5. The file will not be saved locally, so it exists only in the tmp directory.

How can i do this? Thanks.

+6
source share
3 answers

You can use md5_file() or sha1_file() . For example, if your post variable is filevar :

 $myhash = md5_file($_FILES['filevar']['tmp_name']); 
+17
source

You can use md5_file() even in your temporary file.

+3
source

MD5() for string and md5_file() for files

+1
source

Source: https://habr.com/ru/post/1346968/


All Articles