diff --git a/application/common/library/Upload.php b/application/common/library/Upload.php index 66afc1dc8d3d12ad5fe249df56eea86dd6913fb1..6c7eb62b585ec2f108a2693b482417f41eeb5c98 100644 --- a/application/common/library/Upload.php +++ b/application/common/library/Upload.php @@ -36,6 +36,13 @@ class Upload protected $error = ''; + /** + * 保存文件的跟地址 + * + * @var string + */ + protected $saveRootPath = ROOT_PATH . 'public'; + /** * @var \think\File */ @@ -380,6 +387,17 @@ class Upload return $attachment; } + /** + * 设置保存文件的根地址 + * + * @param string $path + * @return self + */ + public function setSaveRootPath($path) { + $this->saveRootPath = $path; + return $this; + } + public function setError($msg) { $this->error = $msg;