Tutorial :Checking md5sum programmatically with php on server



Question:

I'm not sure if what I'm asking is possible. You know how when you download something, you can run an md5sum check on it to verify it hasn't been corrupted when transmitted.

Well, I'm trying to do the same thing programmatically on the server. The file would have been downloaded to the web root folder or some other folder, and I want to run a php script against it to calculate its md5sum. Can php do this?

I'm currently testing on a development environment, wampserver2.


Solution:1

echo md5_file("path/to/file");  


Solution:2

Something as simple as this should do the job:

echo md5(file_get_contents("your-filename-here"));  

But don't rely on it being exceptionally fast.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »