From 4f1eeae98949d6b98cb7cd486e4a6be29601a4b1 Mon Sep 17 00:00:00 2001 From: JaguarJack Date: Sun, 9 May 2021 17:08:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=B8=8A=E4=BC=A0=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- catch/system/controller/Upload.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/catch/system/controller/Upload.php b/catch/system/controller/Upload.php index 079643d..ce643d2 100644 --- a/catch/system/controller/Upload.php +++ b/catch/system/controller/Upload.php @@ -36,13 +36,15 @@ class Upload extends CatchController */ public function image(CatchRequest $request, CatchUpload $upload): \think\response\Json { - $images = $request->file(); + $images = array_values($request->file()); - if (!$images) { + if (!count($images)) { throw new FailedException('请选择图片上传'); } - return CatchResponse::success($upload->checkImages($images)->multiUpload($images['image'])); + return CatchResponse::success($upload->checkImages($images)->multiUpload( + count($images) < 2 ? $images[0] : $images + )); } /**