File upload-php upload image can be directly used to determine the type of file suffix? Why, give a detailed example

Source: Internet
Author: User
PHP upload image can be directly used to determine the type of file suffix? Why, give a detailed example

Reply content:

PHP upload image can be directly used to determine the type of file suffix? Why, give a detailed example

You can, if you like. file header >MINE-Type> filename suffix, but none of them are absolutely secure. Think clearly if someone accidentally made a mistake to pass the suffix of the wrong file, upload the executable file situation what to do.

No, because you can change the name of the non-image suffix to. jpg.

No, because the suffix you can customize. According to @ sell underwear to go online say with getimagesize () judge type is very good.

It's better not to be safe like this.

  • 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.