News: Aug 24, 2007: Michael T. provided a patch to fix some date issues he was having with amazon aws. I have not verified this yet, but seeing as I’m not precisely sure when I will be able to verify it I figured I would put his code up here for you to download if you’re experiencing authentication issues like he was! Get it here: Patched Storage3 Class
Current Version: 1.0.1
CHANGELOG
- 1.0.0
- Initial Public Release
- 1.0.1
- Added function fileExists($s3bucket, $s3file)
- Added support for listing bucket files for buckets with over 1,000 files
- Added contributed function setACL($s3bucket, $s3file, $shorthand=public-read)
- Added support for setting an objects acl during the upload process
- Added grabbing of response headers (which contain a LOT of userful information)
- s3test.php includes an example of using headers to verify the integrity of a file stored in s3 via md5 hash
This is a revised version of the file posted here: http://blog.apokalyptik.com/storage3.phps and includes:
- A local, modified, version of the pear HTTP/Request package
- A local copy of all other required pear packages
- Documentation (under development… docs arent my strong suite)
- An example application (s3test.php)
Cheers!
–Apokalyptik
I have a problem when using the code. I get the following response from Amazon.
[Code] => AccessDenied
[Message] => AWS authentication requires a valid Date or x-amz-date header
[RequestId] => – REMOVED BY APOKALYPTIK –
[HostId] => – REMOVED BY APOKALYPTIK –
[int] => 403
Any idea what the error might be? I use your sample code.
My guess would be that you're using the default bucket name… Which is already taken (bucket names have to be unique through out the entire S3 service, not just per user.
And be careful about giving out your access keys! 🙂
Thanx. Well, I managed to get the buckets created – the program gives no error, and I checked if they are present using the s3-extension to Firefox. It is when I upload a file, the error occurs.