简体   繁体   中英

How to detect image is real image or not in iOS?

Suppose, there is a PHP file in mac os x, or any other file except JPEG, JPG, or PNG.

If I click, and change extension, as below

在此处输入图片说明

Now, if I choose Use .png, it will become a png file, and can be seen in iOS Gallery.

Now, if a person uploads this to server, as profile picture or any way, how can I check that whether it is real image or has something else in form of PNG or JPG.

NOTE: This is only to avoid hackers or harmful scripts.

Thanks.

尝试mime_content_type(),然后进行按类别的条件.. http://php.net/manual/en/function.mime-content-type.php

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM