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 + )); } /**