From 4630ed8397baa6a334a65178f3b1c42500ed6fb1 Mon Sep 17 00:00:00 2001 From: gzydong <837215079@qq.com> Date: Fri, 28 May 2021 18:38:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/Api/V1/ArticleController.php | 4 ++-- app/Controller/Api/V1/TalkController.php | 2 +- app/Controller/Api/V1/UploadController.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Controller/Api/V1/ArticleController.php b/app/Controller/Api/V1/ArticleController.php index daa8e90..4c53fc6 100644 --- a/app/Controller/Api/V1/ArticleController.php +++ b/app/Controller/Api/V1/ArticleController.php @@ -336,7 +336,7 @@ class ArticleController extends CController public function uploadArticleImage() { $file = $this->request->file('image'); - if (!$file->isValid()) { + if (!$file || !$file->isValid()) { return $this->response->fail(); } @@ -463,7 +463,7 @@ class ArticleController extends CController ]); $file = $this->request->file('annex'); - if (!$file->isValid()) { + if (!$file || !$file->isValid()) { return $this->response->fail('上传文件验证失败!'); } diff --git a/app/Controller/Api/V1/TalkController.php b/app/Controller/Api/V1/TalkController.php index ed7da6b..83ae275 100644 --- a/app/Controller/Api/V1/TalkController.php +++ b/app/Controller/Api/V1/TalkController.php @@ -487,7 +487,7 @@ class TalkController extends CController ]); $file = $this->request->file('img'); - if (!$file->isValid()) { + if (!$file || !$file->isValid()) { return $this->response->fail(); } diff --git a/app/Controller/Api/V1/UploadController.php b/app/Controller/Api/V1/UploadController.php index dd4ee38..f1380fb 100644 --- a/app/Controller/Api/V1/UploadController.php +++ b/app/Controller/Api/V1/UploadController.php @@ -98,7 +98,7 @@ class UploadController extends CController 'split_num' => 'required' ]); - if (!$file->isValid()) { + if (!$file || !$file->isValid()) { return $this->response->fail(); }