code: public function getUploadDriver()
      {
          if (empty($this->upload_driver)) {
              $upload_driver = Config::get('upload_driver');
              if ($upload_driver == Upload::TYPE_LOCAL) {
                  $option = Config::get('upload_local');
              } else {
                  $option = Config::get('upload_upyun');
              }
              $this->upload_driver = Upload::create($option, $upload_driver);
              
              // 检查文件
              $this->upload_driver->onCheck = function ($data) {
                  return FileLogic::instance()->getFile($data['hash']);
              };
              
              // 上传成功
              $this->upload_driver->onSuccess = function ($data) {
                  FileLogic::instance()->addFile($data['hash'], $data['url'], $data['type'], FileInfo::getFileSize($data['path']));
              };
          }
          return $this->upload_driver;
      }
docs: 上传驱动
  
  @return \app\common\driver\Upload