🇨🇳 Shenzhen,China・🕹Web developer
如果你喜欢我的项目并想支持我,点击这里 ❤️
:floppy_disk: Flysystem adapter for the Qcloud COS storage.
🇨🇳 Shenzhen,China・🕹Web developer
如果你喜欢我的项目并想支持我,点击这里 ❤️
V3.0.2版本的SDK为1.0不支持8.1的版本!
TP6他的league/flysystem只能1.0,所以没办法只能用V3.0.2版本。谢谢
During inheritance of ArrayAccess: Uncaught think\exception\ErrorException: Return type of Overtrue\CosClient\Config::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/tiger/vendor/overtrue/qcloud-cos-client/src/Config.php:92
Stack trace:
#0 /var/www/html/tiger/vendor/overtrue/qcloud-cos-client/src/Config.php(9): think\initializer\Error->appError()
#1 /var/www/html/tiger/vendor/composer/ClassLoader.php(571): include('/var/www/html/t...')
#2 /var/www/html/tiger/vendor/composer/ClassLoader.php(428): Composer\Autoload\includeFile()
#3 /var/www/html/tiger/vendor/overtrue/qcloud-cos-client/src/ObjectClient.php(23): Composer\Autoload\ClassLoader->loadClass()
#4 /var/www/html/tiger/vendor/overtrue/flysystem-cos/src/CosAdapter.php(352): Overtrue\CosClient\ObjectClient->__construct()
#5 /var/www/html/tiger/vendor/overtrue/flysystem-cos/src/CosAdapter.php(67): Overtrue\Flysystem\Cos\CosAdapter->getObjectClient()
#6 /var/www/html/tiger/vendor/overtrue/flysystem-cos/src/CosAdapter.php(93): Overtrue\Flysystem\Cos\CosAdapter->write()
#7 /var/www/html/tiger/vendor/league/flysystem/src/Filesystem.php(123): Overtrue\Flysystem\Cos\CosAdapter->writeStream()
#8 /var/www/html/tiger/vendor/topthink/framework/src/think/filesystem/Driver.php(142): League\Flysystem\Filesystem->putStream()
#9 /var/www/html/tiger/vendor/topthink/framework/src/think/filesystem/Driver.php(131): think\filesystem\Driver->__call()
#10 /var/www/html/tiger/app/controller/Index.php(14): think\filesystem\Driver->putFileAs()
#11 [internal function]: app\controller\Index->index()
#12 /var/www/html/tiger/vendor/topthink/framework/src/think/Container.php(344): ReflectionMethod->invokeArgs()
#13 /var/www/html/tiger/vendor/topthink/framework/src/think/route/dispatch/Controller.php(110): think\Container->invokeReflectMethod()
#14 /var/www/html/tiger/vendor/topthink/framework/src/think/Pipeline.php(59): think\route\dispatch\Controller->think\route\dispatch\{closure}()
#15 /var/www/html/tiger/vendor/topthink/framework/src/think/Pipeline.php(66): think\Pipeline->think\{closure}()
#16 /var/www/html/tiger/vendor/topthink/framework/src/think/route/dispatch/Controller.php(113): think\Pipeline->then()
#17 /var/www/html/tiger/vendor/topthink/framework/src/think/route/Dispatch.php(90): think\route\dispatch\Controller->exec()
#18 /var/www/html/tiger/vendor/topthink/framework/src/think/Route.php(785): think\route\Dispatch->run()
#19 /var/www/html/tiger/vendor/topthink/framework/src/think/Pipeline.php(59): think\Route->think\{closure}()
#20 /var/www/html/tiger/vendor/topthink/framework/src/think/Pipeline.php(66): think\Pipeline->think\{closure}()
#21 /var/www/html/tiger/vendor/topthink/framework/src/think/Route.php(786): think\Pipeline->then()
#22 /var/www/html/tiger/vendor/topthink/framework/src/think/Http.php(216): think\Route->dispatch()
#23 /var/www/html/tiger/vendor/topthink/framework/src/think/Http.php(206): think\Http->dispatchToRoute()
#24 /var/www/html/tiger/vendor/topthink/framework/src/think/Pipeline.php(59): think\Http->think\{closure}()
#25 /var/www/html/tiger/vendor/topthink/think-trace/src/TraceDebug.php(71): think\Pipeline->think\{closure}()
#26 [internal function]: think\trace\TraceDebug->handle()
#27 /var/www/html/tiger/vendor/topthink/framework/src/think/Middleware.php(142): call_user_func()
#28 /var/www/html/tiger/vendor/topthink/framework/src/think/Pipeline.php(85): think\Middleware->think\{closure}()
#29 /var/www/html/tiger/vendor/topthink/framework/src/think/Pipeline.php(66): think\Pipeline->think\{closure}()
#30 /var/www/html/tiger/vendor/topthink/framework/src/think/Http.php(207): think\Pipeline->then()
#31 /var/www/html/tiger/vendor/topthink/framework/src/think/Http.php(170): think\Http->runWithRequest()
#32 /var/www/html/tiger/public/index.php(20): think\Http->run()
#33 {main}
如题,我想在 Flarum 论坛里用 fof upload 插件搭配这个插件实现上传文件到腾讯COS,请问应该怎么做?谢谢
cURL error 0: The cURL request was retried 3 times and did not succeed. The most likely reason for the failure is that cURL was unable to rewind the body of the request and subsequent retries resulted in the same error. Turn on the debug option to see what went wrong. See https://bugs.php.net/bug.php?id=47204 for more information. (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for
上传超过1M的文件出现这个
使用的框架是hyperf
上传到服务器本地是没有问题的而且上传小文件也是没有问题的
swoole和php.ini的post配置也是改了的
flysystem-cos/tests/CosAdapterTest.php
Line 49 in 7506d15
请问此处的 put()
方法是在哪定义的?我在断点调试模式下测试发现此处报错了。正在学习单元测试,不是很懂这块,麻烦超哥解答下哈 😃
The Signature you specified is invalid.
超哥,需要重新打个tag,现在调用现在调用 getUrl() 方法找不到文件
将配置文件 放在 filesystems.php 文件中 提示 driver 找不到。 driver 应该设置为什么?
readme.md里描述错误
如题:
Deprecated: Return type of Overtrue\CosClient\Config::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /www/discuss/vendor/overtrue/qcloud-cos-client/src/Config.php on line 92
Deprecated: Return type of Overtrue\CosClient\Config::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /www/discuss/vendor/overtrue/qcloud-cos-client/src/Config.php on line 97
还有该文件的102,107行以及src/Http/Response.php的48,57.62,67,72行
虽然是Deprecated,但是还是希望作者能够适配下
cURL error 0: The cURL request was retried 3 times and did not succeed. The most likely reason for the failure is that cURL was unable to rewind the body of the request and subsequent retries resulted in the same error. Turn on the debug option to see what went wrong. See https://bugs.php.net/bug.php?id=47204 for more information. (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for
上传超过1M的文件出现这个
使用的框架是hyperf
上传到服务器本地是没有问题的而且上传小文件也是没有问题的
swoole和php.ini的post配置也是改了的
本地上传 50M没问题. 手动上传腾讯云 50M也没有问题, 但是通过/overtrue/flysystem-cos用腾讯云就只能 1M
原来的 issues没有解决,请问有哪里可以设置的地址吗
Using version ^5.1 for overtrue/flysystem-cos
./composer.json has been updated
Running composer update overtrue/flysystem-cos
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- overtrue/flysystem-cos[5.1.0, ..., 5.1.8] require league/flysystem ^3.0 -> found league/flysystem[3.0.0, ..., 3.24.0] but the package is fixed to 2.5.0 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
- Root composer.json requires overtrue/flysystem-cos ^5.1 -> satisfiable by overtrue/flysystem-cos[5.1.0, ..., 5.1.8].
Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
You can also try re-running composer require with an explicit version constraint, e.g. "composer require overtrue/flysystem-cos:*" to figure out if any version is installable, or "composer require overtrue/flysystem-cos:^2.1" if you know which you need.
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
如题,v3 版本的 getUrl 会对 path 进行一次 rawurlencode 编码(v2版本不会编码),这样在 key 是中文的情况下会存在问题,举例如下:
$path = 'foo/bar/这个是中文的文件名.txt';
$filesystem->write($path, 'test content');
$url = $filesystem->getUrl($path);
Model::create([
'url' => $url
]);
如以上的例子,getUrl 返回的是编码后的 url,假如这时候直接入库,那么保存到数据库中的已经是被编码过了,访问上不影响,但是业务上是不能接受的
由于云存储本身都是支持中文 key 的,所以这里不应该做一次 rawurlencode 编码,而应该原样返回,具体要不要 rawurlencode 交给开发者自行处理
如题,v3 版本的 getUrl 会对 path 进行一次 rawurlencode 编码(v2版本不会编码),这样在 key 是中文的情况下会存在问题,举例如下:
$path = 'foo/bar/这个是中文的文件名.txt';
$filesystem->write($path, 'test content');
$url = $filesystem->getUrl($path);
Model::create([
'url' => $url
]);
如以上的例子,getUrl 返回的是编码后的 url,假如这时候直接入库,那么保存到数据库中的已经是被编码过了,访问上不影响,但是业务上是不能接受的
由于云存储本身都是支持中文 key 的,所以这里不应该做一次 rawurlencode 编码,而应该原样返回,具体要不要 rawurlencode 交给开发者自行处理
getUploadOptions 方法中获取 $config 的语法错误,因为 Config 没有实现 ArrayAccess 接口,所以不能用数组的方式取值
PHP: 7.4.1
Laravel Framework: 6.15.1
https://github.com/overtrue/flysystem-cos/blob/master/src/CosAdapter.php#L407
Argument 1 passed to Overtrue\Flysystem\Cos\CosAdapter::normalizeFileInfo() must be of the type array, string given, called in /Users/eslizn/go/src/github.com/eslizn/kaelthas/vendor/overtrue/flysystem-cos/src/CosAdapter.php on line 186
调试发现只有一个文件时$response['Contents']返回的是一维数组而非二维数组
请问超过5G的大文件如何上传成功
如题,是需要自己拼一个路径吗?
最好能返回文件路径, 大小等详细信息。
由于cos sdk的bug,使用getObjectUrl方法时,导致当未设置过期时间时,默认立即过期,所以需要写明有效期参数。
看到代码中只调用了getObjectUrl(),并且expire传空(默认30 mins),如何获取永久link?
我看官网文档是调用getObjectUrlWithoutSign()方法。https://cloud.tencent.com/document/product/436/60480
若文件不存在,请求的状态码为404, Guzzle
抛出异常
qcloud-cos-client/src/Client.php
中也直接抛出异常
fileExists()
和 getMetadata()
都没处理该异常
// qcloud-cos-client/src/Client.php
public function __call($method, $arguments)
{
try {
return new Response(\call_user_func_array([$this->getHttpClient(), $method], $arguments));
} catch (\GuzzleHttp\Exception\ClientException $e) {
// 文件不存在这里直接抛出了异常
throw new ClientException($e);
} catch (\GuzzleHttp\Exception\ServerException $e) {
throw new ServerException($e);
} catch (\Throwable $e) {
throw new Exception($e->getMessage(), $e->getCode(), $e->getPrevious());
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.