优化代码

main
gzydong 2021-05-28 18:38:10 +08:00
parent 0a3edd9e64
commit 4630ed8397
3 changed files with 4 additions and 4 deletions

View File

@ -336,7 +336,7 @@ class ArticleController extends CController
public function uploadArticleImage() public function uploadArticleImage()
{ {
$file = $this->request->file('image'); $file = $this->request->file('image');
if (!$file->isValid()) { if (!$file || !$file->isValid()) {
return $this->response->fail(); return $this->response->fail();
} }
@ -463,7 +463,7 @@ class ArticleController extends CController
]); ]);
$file = $this->request->file('annex'); $file = $this->request->file('annex');
if (!$file->isValid()) { if (!$file || !$file->isValid()) {
return $this->response->fail('上传文件验证失败!'); return $this->response->fail('上传文件验证失败!');
} }

View File

@ -487,7 +487,7 @@ class TalkController extends CController
]); ]);
$file = $this->request->file('img'); $file = $this->request->file('img');
if (!$file->isValid()) { if (!$file || !$file->isValid()) {
return $this->response->fail(); return $this->response->fail();
} }

View File

@ -98,7 +98,7 @@ class UploadController extends CController
'split_num' => 'required' 'split_num' => 'required'
]); ]);
if (!$file->isValid()) { if (!$file || !$file->isValid()) {
return $this->response->fail(); return $this->response->fail();
} }