tags:

views:

32

answers:

2

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.

+1  A: 

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.

casablanca
+2  A: 
echo md5_file("path/to/file");
Zash