drazwx / ruinuo-attachment-upload
upload file to oos,qiniucloud or cos
dev-master
2022-11-09 04:09 UTC
Requires
- php: >=7.1.0
- aliyuncs/oss-sdk-php: ^2.3
- qcloud/cos-sdk-v5: ^2.0
- qiniu/php-sdk: ^7.2
This package is not auto-updated.
Last update: 2025-01-30 12:45:38 UTC
README
tp6集成qiniu、oss、cos上传
composer
composer require drazwx/ruinuo-attachment-upload
使用方法
config/filesystem.php中增加对应驱动配置
return [
"default" => "qiniu",
"disks" => [
"public" => [
"type" => "local",
"root" => ".",
"visibility" => "public",
"domain" => ""
],
"qiniu" => [
"type" => "qiniu",
"accessKey" => "",
"secretKey" => "",
"bucket" => "",
"domain" => ""
],
"oss" => [
"type" => "oss",
"accessId" => "",
"accessSecret" => "",
"bucket" => "",
"endpoint" => "",
"domain" => ""
],
"cos" => [
"type" => "cos",
"region" => "ap-guangzhou",
"credentials" => [
"appId" => "",
"secretId" => "",
"secretKey" => ""
],
"bucket" => "",
"domain" => "",
"scheme" => "http"
]
]
];
上传
$file = $this->request->file('file');
\think\facade\Filesystem::disk('oss')->putFile('upload', $file);
删除
\think\facade\Filesystem::disk('oss')->delete($path);
更详细用法参考Adapter对应文件