Jump to content

Recommended Posts

Hi,

I got to code a script which would check the md5 checksum of a file is valid or not. I dont want to run the script as a shell script but using a server side script. I am not sure on how to accomplish the same.  I hope someone would have some idea regarding it and would help me in it. Thank You :)

Hmmm.... I forget exactly how filesums work, but couldn't you do something like:

 

<?php
$checksum = 'blahblahblah'; //ehhh md5 checksum lol

$content = file_get_contents('path/to.file');

$sum = md5($content);

if($sum == $checksum) echo 'Match!';


?>

I think it is working. I took the md5 of the file using md5sum command and compared it with the one we get by using the above script. Both were different  ??? . So I think I should not go for that method. Instead get the md5 sum of the file using the above script, save it and in the future get the stored md5 value of the file and then compare with the one generated by the script above. I think that might work. Thank you corbin.  :) (I may come back. So not marking this thread as solved  ;D )

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.