gpt4 book ai didi

php 如何使用 getimagesize() 检查上传时的图像类型

转载 作者:塔克拉玛干 更新时间:2023-11-03 05:59:30 25 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
GetImageSize() not returning FALSE when it should

我目前有一个过滤系统如下:

   // Check to see if the type of file uploaded is a valid image type
function is_valid_type($file)
{
// This is an array that holds all the valid image MIME types
$valid_types = array("image/jpg", "image/JPG", "image/jpeg", "image/bmp", "image/gif", "image/png");

if (in_array($file['type'], $valid_types))
return 1;
return 0;
}

但有人告诉我最好自己检查文件类型,我如何使用 getimagesize() 以类似的方式检查文件类型?

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com