think\File::check PHP Method

check() public method

检测上传文件
public check ( array $rule = [] ) : boolean
$rule array 验证规则
return boolean
    public function check($rule = [])
    {
        $rule = $rule ?: $this->validate;
        /* 检查文件大小 */
        if (isset($rule['size']) && !$this->checkSize($rule['size'])) {
            $this->error = '上传文件大小不符!';
            return false;
        }
        /* 检查文件Mime类型 */
        if (isset($rule['type']) && !$this->checkMime($rule['type'])) {
            $this->error = '上传文件MIME类型不允许!';
            return false;
        }
        /* 检查文件后缀 */
        if (isset($rule['ext']) && !$this->checkExt($rule['ext'])) {
            $this->error = '上传文件后缀不允许';
            return false;
        }
        /* 检查图像文件 */
        if (!$this->checkImg()) {
            $this->error = '非法图像文件!';
            return false;
        }
        return true;
    }