提交 48107a74 编写于 作者: D Devil

编辑器粘贴优化

上级 97826ae8
...@@ -350,7 +350,8 @@ class Uploader ...@@ -350,7 +350,8 @@ class Uploader
$imgUrl = str_replace("&", "&", $imgUrl); $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"); $this->stateInfo = $this->getStateInfo("ERROR_TYPE_NOT_ALLOWED");
return; return;
} }
...@@ -502,9 +503,10 @@ class Uploader ...@@ -502,9 +503,10 @@ class Uploader
* 文件类型检测 * 文件类型检测
* @return bool * @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"]);
} }
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册