Passer au contenu

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

demandé il y a 4 ans861 vues
1 réponse
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
répondu il y a 4 ans

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.