$mime_types = array( 
'gif' => 'image/gif', 
'jpg' => 'image/jpeg', 
'jpeg' => 'image/jpeg', 
'jpe' => 'image/jpeg', 
'bmp' => 'image/bmp', 
'png' => 'image/png', 
'tif' => 'image/tiff', 
'tiff' => 'image/tiff', 
'pict' => 'image/x-pict', 
'pic' => 'image/x-pict', 
'pct' => 'image/x-pict', 
'tif' => 'image/tiff', 
'tiff' => 'image/tiff', 
'psd' => 'image/x-photoshop', 

解决方案 »

  1.   

    function validate_format()
        {        if (!is_array($this->fileformat))  // 没有格式限制
                return true;
           $ext = strtolower($this->ext);
            reset($this->fileformat);
            while(list($var, $key) = each($this->fileformat))
            {
                if (strtolower($key) == $ext)//////把$key和$ext打印出来,看看是不是相等
                    return true;
            }
            reset($this->fileformat);
            return false;
        }