mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-05 19:41:44 +08:00
修改文件上传文件名称验证
This reverts commit cd52d2c1dd8c2b05e55db6f1e54a5f225edfbd6c.
This commit is contained in:
parent
cd52d2c1dd
commit
29b05dee3d
@ -111,8 +111,6 @@ class Upload extends Controller
|
||||
$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('文件后缀异常,请重新上传文件!');
|
||||
|
Loading…
x
Reference in New Issue
Block a user