我可以信任 $_FILES 中的文件类型吗? [英] Can I trust the file type from $_FILES?
本文介绍了我可以信任 $_FILES 中的文件类型吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
上传图片时,我可以信任 $_FILES
中的文件类型吗?还是我必须用 exif_imagetype()
再次检查?
Can I trust the file type from $_FILES
when uploading images? Or do I have to check again with exif_imagetype()
?
推荐答案
来自 文档:
文件的 MIME 类型,如果浏览器提供了此信息.一个例子是图像/gif".然而,这种 MIME 类型不会在 PHP 端检查,因此不要认为它的值是理所当然的.
The mime type of the file, if the browser provided this information. An example would be "image/gif". This mime type is however not checked on the PHP side and therefore don't take its value for granted.
这篇关于我可以信任 $_FILES 中的文件类型吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文