From 48107a745341d3eff53b510442faa62f023ac34b Mon Sep 17 00:00:00 2001 From: Devil Date: Wed, 28 Jul 2021 20:55:54 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=99=A8=E7=B2=98=E8=B4=B4?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extend/base/Uploader.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/extend/base/Uploader.php b/extend/base/Uploader.php index b2b3acc20..3a4556ce1 100755 --- a/extend/base/Uploader.php +++ b/extend/base/Uploader.php @@ -350,7 +350,8 @@ class Uploader $imgUrl = str_replace("&", "&", $imgUrl); //检查是否不允许的文件格式 - if (!$this->checkType()) { + $ext = explode('?', strtolower(strrchr($imgUrl, '.'))); + if (!$this->checkType($ext[0])) { $this->stateInfo = $this->getStateInfo("ERROR_TYPE_NOT_ALLOWED"); return; } @@ -502,9 +503,10 @@ class Uploader * 文件类型检测 * @return bool */ - private function checkType() + private function checkType($ext = null) { - return in_array($this->getFileExt(), $this->config["allowFiles"]); + $ext = empty($ext) ? $this->getFileExt() : $ext; + return in_array($ext, $this->config["allowFiles"]); } /** -- GitLab