PHP MD5 Code _php tutorial to get uploaded files

Source: Internet
Author: User
Tags md5 hash
Since it is necessary to determine if the uploaded file has been modified, the MD5 value of the uploaded file needs to be recorded, and the method of obtaining the MD5 value of the file is recorded here.

if (Isset ($_files[' Multimedia ')) && $_files[' multimedia ' [' ERROR ']==0] {$file _name = $_files[' multimedia '] [' Name ']; $size = getimagesize ($_files[' multimedia ' [' tmp_name ']);    $type = $_files[' multimedia ' [' type ']; $original = $_files[' multimedia ' [' tmp_name ']; $MD 5 = Md5_file ($original); echo $ MD5;}

Md5_file ()

The Md5_file () function computes the MD5 hash of the file. The MD5 () function uses RSA data security, including the MD5 message selected passage algorithm. If successful, returns the computed MD5 hash, or False if it fails.

Syntax: MD5 (STRING,RAW)

    • Parameter string, required. Specify the documents to be calculated.
    • Parameter charlist, optional. Specify hexadecimal or binary output format: TRUE-original 16 character binary format; FALSE-Default. 32 character hexadecimal number.
 
  

To store the MD5 hash of the "test.txt" file:

 
  

In this example, we will detect if "test.txt" has been changed (that is, if the MD5 hash has been changed):

 
    

Output:

The file is OK.

http://www.bkjia.com/PHPjc/752562.html www.bkjia.com true http://www.bkjia.com/PHPjc/752562.html techarticle since it is necessary to determine if the uploaded file has been modified, the MD5 value of the uploaded file needs to be recorded, and the method of obtaining the MD5 value of the file is recorded here. if (Isset ($_files[' multimedia ') $_files[' ...

  • Related Article

    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.