我正在尝试将一个S3分块上传器从Laravel 8升级到Laravel 9,并根据文档中的说明升级到Flysystem 3,没有依赖错误。但我无法访问底层的S3Client以创建分片上传。请参考https://laravel.com/docs/9.x/upgrade#flysystem-3。
然而,Laravel 9抛出了一个异常:
我查看了League\Flysystem的源代码和Laravel的更新,但似乎无法找到正确的方法来处理更新并访问底层的
我的大型项目正在使用一个分支的laravel-uppy-s3-multipart-upload库,可以在这里看到:https://github.com/kerkness/laravel-uppy-s3-multipart-upload/tree/laravel9。
// Working in Laravel 8
// Laravel 9 throws exception on getAdapter()
$client = Storage::disk('s3')->getDriver()->getAdapter()->getClient();
// Underlying S3Client is used to create Multipart uploader as below
$bucket = config('filesystems.disks.s3.bucket');
$result = $client->createMultipartUpload([
'Bucket' => $bucket,
'Key' => $key,
'ContentType' => 'image/jpeg',
'ContentDisposition' => 'inline',
]);
return response()
->json([
'uploadId' => $result['UploadId'],
'key' => $result['Key'],
]);
然而,Laravel 9抛出了一个异常:
Call to undefined method League\Flysystem\Filesystem::getAdapter()
。我查看了League\Flysystem的源代码和Laravel的更新,但似乎无法找到正确的方法来处理更新并访问底层的
Aws\S3\S3Client
。我的大型项目正在使用一个分支的laravel-uppy-s3-multipart-upload库,可以在这里看到:https://github.com/kerkness/laravel-uppy-s3-multipart-upload/tree/laravel9。