mirror of https://gitee.com/karson/fastadmin.git
修复上传类型配置mimetype无效的BUG
parent
82966e07c3
commit
285095f80f
|
|
@ -90,13 +90,12 @@ class Upload
|
||||||
$mimetypeArr = explode(',', strtolower($this->config['mimetype']));
|
$mimetypeArr = explode(',', strtolower($this->config['mimetype']));
|
||||||
$typeArr = explode('/', $this->fileInfo['type']);
|
$typeArr = explode('/', $this->fileInfo['type']);
|
||||||
//验证文件后缀
|
//验证文件后缀
|
||||||
if ($this->config['mimetype'] !== '*' &&
|
if ($this->config['mimetype'] === '*'
|
||||||
(!in_array($this->fileInfo['suffix'], $mimetypeArr) || (stripos($typeArr[0] . '/', $this->config['mimetype']) !== false && (!in_array($this->fileInfo['type'], $mimetypeArr) && !in_array($typeArr[0] . '/*', $mimetypeArr))))
|
|| in_array($this->fileInfo['suffix'], $mimetypeArr) || in_array('.' . $this->fileInfo['suffix'], $mimetypeArr)
|
||||||
) {
|
|| in_array($this->fileInfo['type'], $mimetypeArr) || in_array($typeArr[0] . "/*", $mimetypeArr)) {
|
||||||
throw new UploadException(__('Uploaded file format is limited'));
|
return true;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
return true;
|
throw new UploadException(__('Uploaded file format is limited'));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function checkImage($force = false)
|
protected function checkImage($force = false)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue