jst4fun Posted August 7, 2007 Share Posted August 7, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/63661-solved-checking-md5checksum-of-a-file-using-php/ Share on other sites More sharing options...
corbin Posted August 7, 2007 Share Posted August 7, 2007 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!'; ?> Quote Link to comment https://forums.phpfreaks.com/topic/63661-solved-checking-md5checksum-of-a-file-using-php/#findComment-317261 Share on other sites More sharing options...
jst4fun Posted August 7, 2007 Author Share Posted August 7, 2007 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 ) Quote Link to comment https://forums.phpfreaks.com/topic/63661-solved-checking-md5checksum-of-a-file-using-php/#findComment-317281 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.