PHP obtains the file md5 and checks whether the file is modified. _ PHP Tutorial-php Tutorial

Source: Internet
Author: User
Tags md5 hash
PHP obtains the file md5 and checks whether the file is modified ,. PHP obtains the md5 value of the file and checks whether the file has been modified. to determine whether the uploaded file has been modified, it is necessary to record the md5 value of the uploaded file, so here we will talk about getting the file md PHP to get the file md5 and check whether it has been modified,

To determine whether the uploaded file has been modified, you need to record the md5 value of the uploaded file. here we will talk about how to obtain the md5 value of the file.

Md5_file ()

MD5 hash of the md5_file () function compute file. The md5 () function uses RSA Data Security, including the MD5 packet excerpt algorithm. If the calculation succeeds, the calculated MD5 hash is returned. if the calculation fails, false is returned.

Syntax: md5 (string, raw)

§ String parameter, required, specifies the file to be calculated.

§ Parameter charlist, optional. The hexadecimal or binary output format is required: TRUE-original 16-character binary format; FALSE-default. 32 characters in hexadecimal notation.

MD5 hash for storing the "test.doc" file:

Now, we will check whether "test.doc" has been changed (that is, whether the MD5 hash has been changed ):

The end.




Upload, because you need to determine whether the uploaded file has been modified, you need to record the md5 value of the uploaded file, so here we will talk about getting the file md...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.