From b9acfbea2b82ca960425fca4f3bce86b90ba2bf3 Mon Sep 17 00:00:00 2001 From: yanwenwu Date: Sat, 25 Jan 2020 20:06:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=B8=8A=E4=BC=A0=E6=8F=92?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extend/catcher/CatchUpload.php | 117 +++++++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 extend/catcher/CatchUpload.php diff --git a/extend/catcher/CatchUpload.php b/extend/catcher/CatchUpload.php new file mode 100644 index 0000000..864cf4a --- /dev/null +++ b/extend/catcher/CatchUpload.php @@ -0,0 +1,117 @@ +getDriver())->putFile($this->getPath(), $file); + } + + /** + * get upload driver + * + * @author JaguarJack + * @email njphper@gmail.com + * @time 2020/1/25 + * @return string + */ + protected function getDriver() + { + return $this->driver; + } + + /** + * set driver + * + * @author JaguarJack + * @email njphper@gmail.com + * @time 2020/1/25 + * @param $driver + * @throws \Exception + * @return $this + */ + public function setDriver($driver) + { + if (!in_array($driver, [self::OSS, self::QCLOUD, self::QIQNIU, self::LOCAL])) { + throw new \Exception(sprintf('Upload Driver [%s] Not Supported', $driver)); + } + + $this->driver = $driver; + + return $this; + } + + /** + * + * @author JaguarJack + * @email njphper@gmail.com + * @time 2020/1/25 + * @return string + */ + protected function getPath() + { + return $this->path; + } + + /** + * + * @author JaguarJack + * @email njphper@gmail.com + * @time 2020/1/25 + * @param string $path + * @return $this + */ + public function setPath(string $path) + { + $this->path = $path; + + return $this; + } +} \ No newline at end of file