[英]League\\Flysystem\\AwsS3v3\\AwsS3Adapter::__construct(): Argument #1 ($client) must be of type Aws\\S3Client, Aws\\S3\\S3Client given
I have installed the s3 flysystem package by running the following composer command in my Laravel 8
project我通过在我的
Laravel 8
项目中运行以下 composer 命令安装了 s3 flysystem package
composer require --with-all-dependencies league/flysystem-aws-s3-v3 "^1.0"
and tried to store a file from the request as并尝试将请求中的文件存储为
$imageName = $request->file('file')->store('uploads');
I got the following error我收到以下错误
League\Flysystem\AwsS3v3\AwsS3Adapter::__construct(): Argument #1 ($client) must be of type Aws\S3Client, Aws\S3\S3Client given, called in D:\Projects\Rescale\vendor\laravel\framework\src\Illuminate\Filesystem\FilesystemManager.php on line 229
League\Flysystem\AwsS3v3\AwsS3Adapter::__construct():参数 #1 ($client) 必须是 Aws\S3Client 类型,Aws\S3\S3Client 给定,在 D:\Projects\Rescale\vendor\laravel\framework\ 中调用src\Illuminate\Filesystem\FilesystemManager.php 在第 229 行
So it seems ThePHPLeague Flysystem major version got updated (to v2) thus breaking a lot of stuff since latest Laravel depends on "^1.1" (see:https://github.com/laravel/framework/blob/8.x/composer.json#L27 ).因此,似乎 ThePHPLeague Flysystem 主要版本已更新(到 v2),因此破坏了很多东西,因为最新的 Laravel 依赖于“^1.1”(参见:https://github.com/laravel/framework/blob/8.x/composer .json#L27 )。
I've had this error, so my workaround is to use a specific version instead.我遇到了这个错误,所以我的解决方法是改用特定版本。
- "league/flysystem-aws-s3-v3": "^1.0",
+ "league/flysystem-aws-s3-v3": "1.0.29",
composer update
and let composer update your dependencies.composer update
并让 composer 更新你的依赖。try this to upload an image on AWS试试这个在 AWS 上上传图片
$path = Storage::disk('s3')->put('uploads', $request->file('file'));
try this尝试这个
composer require --with-all-dependencies league/flysystem-aws-s3-v3 "~1.0"
I got same error in Laravel version 8我在 Laravel 版本 8 中遇到了同样的错误
composer.json
and change inside version to "league/flysystem-aws-s3-v3": "^1.0"
composer.json
并将内部版本更改为"league/flysystem-aws-s3-v3": "^1.0"
composer update
composer update
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.