April 2013

Private Bulk Upload to Amazon S3 in Drupal

If you are using Amazon S3 services and need to upload large files or you want an ad-hoc "page" to upload large files that it can be downloaded by another party, S3 gives a trivially easy way to do this.
1. Create a bucket in S3
2. You'll need a policy and signature to upload. use the simple php script to generate it

$policy_doc = '{"expiration": "2199-01-01T00:00:00Z",' . "\n" .
'"conditions": [' . "\n" .
'{"bucket": "YOURBUCKETNAME"},' . "\n" .
'["starts-with", "$key", "UPLOADFOLDER/"],' . "\n" .