abstract:文件上传
//处理文件上传 public function demo() { $file = Request::file('file'); if(is_null($file)){ $this->error('请选择上传文件'); } $rule = ['size'=>2097152, 'ext'=>'jpg,jpeg,png,gif','type'=>'image/jpeg,image/png,image/gif']; if($file->check($rule)) { $fileInfo = $file->move('uploads'); $res = '上传成功
文件名是:'.$fileInfo->getSaveName(); } else { $res = '上传失败
'.$file->getError(); } return $res; }
Correcting teacher:天蓬老师Correction time:2018-12-29 17:39:36
Teacher's summary:你这是有框架了吗?为什么不将代码复制完整?