ankitpokhrel / ankitpokhrel/tus-php
Please kindly explain this code to me
- 主要语言
- PHP
- 星标
- 1.5k
- 派生
- 220
- PR 合并指标
- 30 天内没有已合并 PR
描述
```
// server.php
// composer require aws/aws-sdk-php
use Aws\S3\S3Client;
use TusPhp\Tus\Server;
use Aws\Credentials\Credentials;
$awsAccessKey = 'AWS_ACCESS_KEY'; // YOUR AWS ACCESS KEY
$awsSecretKey = 'AWS_SECRET_KEY'; // YOUR AWS SECRET KEY
$awsRegion = 'eu-west-1'; // YOUR AWS BUCKET REGION
$basePath = 's3://your-bucket-name';
$s3Client = new S3Client([
'version' => 'latest',
'region' => $awsRegion,
'credentials' => new Credentials($awsAccessKey, $awsSecretKey)
]);
$s3Client->registerStreamWrapper();
$server = new Server('file');
$server->setUploadDir($basePath);
$response = $server->serve();
$response->send();
exit(0);
```
My question is that how does the file gets transfered to s3 storage because I can see that $s3Client is not been used in Server() constructor, then how does $s3Client know where the file is for upload. The setUploadDir($basePath); is only using the basePath of the s3 location but not the $s3Client. Its not possible to use just the basepath to upload file to s3 without authorization.
Please i need clear explanations on how the code works above or is the code not complete?
贡献指南
这个仓库没有索引到贡献指南
评估
这个 Issue 还没有评估数据。