Skip to content
Advertisement

PHP S3 – How to get all versions of a specific file

I have a Laravel project and a version enabled S3 bucket. I can list the versions of all objects within the bucket using the listObjectVersions method.

My attempt to list the versions of a specific object is as follows:

JavaScript

This seems to get all objects within the bucket which is not what I want. Is there a way to get just one file?

I am using the AWS PHP SDK.

Thanks

Advertisement

Answer

You can use ‘Prefix’ instead of ‘Key’:

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement