スキップしてコンテンツを表示

Search files via PHP SDK filtering with limit and date

0

I need to search files on AWS S3 storage using some filter:

  • range date
  • storage class
  • num max items

I'm using "aws/aws-sdk-php" : "^3.239" library

$objects = $this->client->getIterator('ListObjects', [
				'Bucket' => S3_BUCKET_NAME,
				'Prefix' => $folder,
				'MaxKeys' => 10,	// NOT WORKS
				'StorageClass' => "STANDARD"	// NOT WORKS
		]);

		foreach ($objects as $object) {	
			...
		}

Could you please support me?

Thanks L

質問済み 4年前861ビュー

1回答
0

The Iterator method is for the php V2. If you are using PHP V3, could you try with the paginator. A Paginator is essentially an iterator of results. They are created via the getPaginator() method of the client.

Resources for review: [1]: https://docs.aws.amazon.com/zh_cn/aws-sdk-php/guide/latest/guide/paginators.html [2]: https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-Aws.AwsClientInterface.html#_getPaginator [3]: https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-s3-2006-03-01.html#listobjects

AWS

回答済み 4年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

関連するコンテンツ