Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8853169
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:35:07+00:00 2026-06-14T13:35:07+00:00

It is mentioned in this very related question ( Upload directly to Amazon S3

  • 0

It is mentioned in this very related question (Upload directly to Amazon S3 using Plupload HTML5 runtime) that amazon now allows CORS uploads using HTML5, but has anyone successfully configured plupload to push files to s3 using the ‘html5’ runtime? Responses to the related question do not offer any implementation details.

Here is my current plupload configuration:

$("#uploader").plupload({
    // General settings
    runtimes: 'html5,flash',
    url: 'http://s3.amazonaws.com/' + $('#Bucket').val(),
    max_file_size: '20mb',
    multipart: true,
    multipart_params: {
        'key': '${filename}', // use filename as a key
        'Filename': '${filename}', // adding this to keep consistency across the runtimes
        'acl': $('#Acl').val(),
        'Content-Type': 'binary/octet-stream',
        'success_action_status': '201',
        'AWSAccessKeyId': $('#AWSAccessKeyId').val(),
        'policy': $('#Policy').val(),
        'signature': $('#Signature').val()
    },
    file_data_name: 'file',
    multiple_queues: true,
    filters: [
        { title: "Image files", extensions: "jpg,png,gif,jpeg" }
    ],
    flash_swf_url: '/Scripts/plupload/plupload.flash.swf',
});

The above code is working for the ‘flash’ runtime, so the policy is generated and signed correctly.

Am I missing any arguments in the multipart_params configuration object?

Also, I am using the following CORS configuration on my s3 bucket:

<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
    <CORSRule>
        <AllowedOrigin>*</AllowedOrigin>
        <AllowedMethod>PUT</AllowedMethod>
        <AllowedMethod>POST</AllowedMethod>
        <AllowedMethod>GET</AllowedMethod>
        <AllowedMethod>HEAD</AllowedMethod>
        <MaxAgeSeconds>3000</MaxAgeSeconds>
        <AllowedHeader>*</AllowedHeader>
    </CORSRule>
</CORSConfiguration>

Do I need to make any other configuration changes to the s3 bucket to allow CORS uploads from the ‘html5’ plupload runtime?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T13:35:08+00:00Added an answer on June 14, 2026 at 1:35 pm

    Here’s the exact code I used to get this to work…

    var params = {};
    
            $('#uploader').pluploadQueue({
                runtimes: 'html5,flash',
                flash_swf_url: '/js/plupload/1.5.4/plupload.flash.swf', // Have to load locally
                url: 'https://s3.amazonaws.com/my-bucket-name',
                multiple_queues: true,
                preinit: {
                    UploadFile: function (up, file) {
                        up.settings.multipart_params = {
                            key: file.name,
                            filename: file.name,
                            AWSAccessKeyId: 'my-aws-access-key',
                            acl: 'private',
                            policy: params[file.name]["policy"],
                            signature: params[file.name]["signature"],
                            success_action_status: '201'
                        }
                    }
                },
                init: {
                    FilesAdded: function (up, files) {
                        plupload.each(files, function (file) {
    
                            $.ajax({
                                url: '/r/prepare_raw_upload',
                                type: 'post',
                                data: {
                                    acl: 'private',
                                    bucket: 'my-bucket-name',
                                    file: file.name
                                },
                                success: function (data) {
                                    if (data.success) {
                                        params[data.file] = { policy: data.policy, signature: data.signature };
                                    }
                                    else if (data.message) {
                                        alert(data.message);
                                    }
                                }
                            });
    
                        });
                    }
                }
            });
    

    You’ll notice in the FilesAdded event listener I have an ajax call. This retrieves the policy and the signature from my server for each file added.

    Here’s the code on the back that sends back the policy and signature

    public static Dictionary<string, object> prepareUpload(DateTime now, string acl, string bucket, string key, string file)
        {
            Dictionary<string, object> result = new Dictionary<string, object>();
            ASCIIEncoding encoding = new ASCIIEncoding();
    
            string policy = createUploadPolicy(now, acl, bucket, key);
            result.Add("policy", Convert.ToBase64String(encoding.GetBytes(policy)));
            result.Add("signature", createUploadSignature(policy));
            result.Add("file", file);
    
            return result;
        }
    
        public static string createUploadPolicy(DateTime now, string acl, string bucket, string key)
        {
            ASCIIEncoding encoding = new ASCIIEncoding();
            JavaScriptSerializer jss = new JavaScriptSerializer();
    
            Hashtable policy = new Hashtable();
            policy.Add("expiration", now.AddDays(1).ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss.fff'Z'"));
            ArrayList conditions = new ArrayList();
            conditions.Add(new Hashtable { { "acl", acl } });
            conditions.Add(new Hashtable { { "bucket", bucket } });
            conditions.Add(new Hashtable { { "key", key } });
            conditions.Add(new ArrayList { "starts-with", "$name", "" });
            conditions.Add(new ArrayList { "starts-with", "$filename", "" });
            conditions.Add(new ArrayList { "starts-with", "$success_action_status", "" });
            policy.Add("conditions", conditions);
    
            return jss.Serialize(policy);
        }
    
        public static string createUploadSignature(string policy)
        {
            ASCIIEncoding encoding = new ASCIIEncoding();
            byte[] policyBytes = encoding.GetBytes(policy);
            string policyBase64 = Convert.ToBase64String(policyBytes);
    
            byte[] secretKeyBytes = encoding.GetBytes(ConfigurationManager.AppSettings["AWSSecretKey"]);
            HMACSHA1 hmacsha1 = new HMACSHA1(secretKeyBytes);
    
            byte[] policyBase64Bytes = encoding.GetBytes(policyBase64);
            byte[] signatureBytes = hmacsha1.ComputeHash(policyBase64Bytes);
    
            return Convert.ToBase64String(signatureBytes);
        }
    

    Very helpful links in making this work were…

    How do I make Plupload upload directly to Amazon S3?

    http://codeonaboat.wordpress.com/2011/04/22/uploading-a-file-to-amazon-s3-using-an-asp-net-mvc-application-directly-from-the-users-browser/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In this question , I mentioned my assumption that rubyforge gems are more official,
somebody mentioned that the function (in this case a method) below is no good
I have followed this tutorial here as mentioned exactly I now try to run
Some people have mentioned RockScroll and MetaScroll in This Question , but those only
I came across this question on a website. As mentioned there, it was asked
I am completely perplexed. I asked this question and it (any mentioned solution) doesn't
Looking through PIL (and related to this question ), where can I get a
So, as mentioned in this answer and in the iOS 4.0 release notes ,
HI May i know how to make the scroll view as mentioned in this
I know this issue being mentioned before, but resolutions there didn't apply. I'm having

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.