Skip to content
Permalink
Browse files
修改文件上传文件名称验证
This reverts commit cd52d2c.
  • Loading branch information
zoujingli committed Sep 15, 2021
1 parent cd52d2c commit 29b05dee3d27a807ac50bbc7601ab4f742a9db60
Showing with 0 additions and 2 deletions.
  1. +0 −2 app/admin/controller/api/Upload.php
@@ -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('文件后缀异常,请重新上传文件!');

0 comments on commit 29b05de

Please sign in to comment.