Skip to content

Commit

Permalink
修改文件上传文件名称验证
Browse files Browse the repository at this point in the history
This reverts commit cd52d2c.
  • Loading branch information
zoujingli committed Sep 15, 2021
1 parent cd52d2c commit 29b05de
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions app/admin/controller/api/Upload.php
Expand Up @@ -111,8 +111,6 @@ public function file()
$safeMode = $this->getSafe();
$extension = strtolower($file->getOriginalExtension());
$saveName = input('key') ?: Storage::name($file->getPathname(), $extension, '', 'md5_file');
// 检查文件名称是否合法
if (strpos($saveName, '../') !== false) $this->error('文件路径不能出现跳级操作!');
// 检查文件后缀是否被恶意修改
if (pathinfo(parse_url($saveName, PHP_URL_PATH), PATHINFO_EXTENSION) !== $extension) {
$this->error('文件后缀异常,请重新上传文件!');
Expand Down

0 comments on commit 29b05de

Please sign in to comment.