You are here

function hook_s3fs_cors_sign_request_options_alter in S3 File System CORS Upload 7

Alters the options used when writing a file to the bucket using the CORS widget. To learn the valid values for these options, you'll need to be familiar with the PostObject class from the AWS SDK for PHP: http://docs.aws.amazon.com/aws-sdk-php/v2/api/class-Aws.S3.Model.PostObj...

Parameters

array $options: Associative array of options (defaults):

  • 'acl': (string) Set the access control for the file. Detault: 'public-read'.
  • 'Content-Type': (string) The file's mimetype, prefixed with ^.
  • key: (string) The filename in the bucket.
  • ttd: (string) How long the signed request should be viable. Default: "+5 minutes".

More values can be added if needed, see the PostPbject API docs (linked above) for details.

1 invocation of hook_s3fs_cors_sign_request_options_alter()
s3fs_cors_sign_request in ./s3fs_cors.module
AJAX callback to create paramaters necessary for submitting a CORS request.

File

./s3fs_cors.api.php, line 31
This file contains no working PHP code; it exists to provide additional documentation for doxygen as well as to document hooks in the standard Drupal manner.

Code

function hook_s3fs_cors_sign_request_options_alter(&$options) {

  // Make all files uploaded to your bucket through CORS private.
  // This will break most typical access to said files, so only do this if you're sure
  // its what you want.
  $options['acl'] = "private";
}