Amazon S3 CORS Upload
This module works in conjunction with the amazons3 module to provide direct to S3 uploading from your browser. Bypassing the Drupal file system and storing all files in S3 only.
When using this method to upload files to S3 files are uploaded directly from the user's browser to S3 and not stored in the local file system. This can be nice in that you don't have to upload files to Drupal first and then have Drupal transfer them to S3 for you. The module then stores a managed file record in Drupal for the new file and the file is then treated just like any file that was uploaded via the normal means.
The module provides a new field widget for file fields.
The module provides a new #type = amazons3_cors_upload element that can be used by others and functions similar to the #type = managed_file element. Display a file upload widget and when the form is submitted your submit handler will be given the FID of the new file.
Both the field widget and FAPI element support display of upload progress via XHR upload progress in browser's that support cool things like that.
In order to work with S3 you'll need to configure a CORS (Cross Origin Resource Sharing) policy for your bucket. Create a policy be navigating to the permissions screen for your S3 bucket and clicking the "Edit CORS Configuration" button and creating a policy suitable for your use case. Something like the following should do the trick and allow only uploads from https://example.com
<?xml version="1.0" encoding="UTF-8"?> <CORSConfiguration xmlns="https://s3.amazonaws.com/doc/2006-03-01/"> <CORSRule> <AllowedOrigin>https://example.com</AllowedOrigin> <AllowedMethod>POST</AllowedMethod> <MaxAgeSeconds>3000</MaxAgeSeconds> <AllowedHeader>*</AllowedHeader> </CORSRule> </CORSConfiguration>
You will also need to enter your AWS keys into the configuration screen for AWSSDK or add them to yur settings.php file:
$conf['amazons3_bucket'] = ''; $conf['aws_key'] = ''; $conf['aws_secret'] = '';
An Amazon Web Services account.
Current Known Bugs / Limitations / other things.
This module has not been tested w/ multiple value file fields and will likely fail in a ball of fire. You've been warned.
This is still somewhat experimental and has not been used in a production environment. Though in my testing thus far it's accomplishing what I need it to including uploads of 1Gb + files.
|7.x-2.x-dev||tar.gz (16.86 KB) | zip (19.19 KB)||2016年1月21日||发布说明||简 | 繁 | 更多|
|7.x-1.x-dev||tar.gz (15.71 KB) | zip (18 KB)||2016年1月19日||发布说明||简 | 繁 | 更多|