diff --git a/extend/think/filesystem/adapter/QiniuAdapter.php b/extend/think/filesystem/adapter/QiniuAdapter.php new file mode 100644 index 0000000..abd491f --- /dev/null +++ b/extend/think/filesystem/adapter/QiniuAdapter.php @@ -0,0 +1,33 @@ +get('mime', 'application/octet-stream'); + + /** + * @var Error|null $error + */ + [, $error] = $this->getUploadManager()->put( + $this->getAuthManager()->uploadToken($this->bucket, null, 3600 , [ + 'fileType'=>5 + ]), + $path, + $contents, + null, + $mime, + $path + ); + + if ($error) { + throw UnableToWriteFile::atLocation($path, $error->message()); + } + } +} diff --git a/extend/think/filesystem/driver/Qiniu.php b/extend/think/filesystem/driver/Qiniu.php index f715d83..04f7b22 100644 --- a/extend/think/filesystem/driver/Qiniu.php +++ b/extend/think/filesystem/driver/Qiniu.php @@ -3,10 +3,10 @@ namespace think\filesystem\driver; use League\Flysystem\FilesystemAdapter; +use think\filesystem\adapter\QiniuAdapter; use think\filesystem\Driver; -use Overtrue\Flysystem\Qiniu\QiniuAdapter; -class Qiniu extends Driver +class Qiniu extends Driver { protected function createAdapter(): FilesystemAdapter {