1

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.

4

2 回答 2

5
echo md5_file("path/to/file");
于 2010-07-04T03:09:06.213 回答
1

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.

于 2010-07-04T02:13:31.303 回答