How do I make Plupload upload directly to Amazon S3?

Vebjorn Ljosa picture Vebjorn Ljosa · Jan 9, 2011 · Viewed 12.3k times · Source

How do I configure Plupload properly so that it will upload files directly to Amazon S3?

Answer

Vebjorn Ljosa picture Vebjorn Ljosa · Jan 9, 2011
  • In addition to condictions for bucket, key, and acl, the policy document must contain rules for name, Filename, and success_action_status. For instance:

        ["starts-with", "$name", ""],
        ["starts-with", "$Filename", ""],
        ["starts-with", "$success_action_status", ""],
    

    Filename is a field that the Flash backend sends, but the HTML5 backend does not.

  • The multipart setting must be True, but that is the default these days.

  • The multipart_params setting must be a dictionary with the following fields:

    • key
    • AWSAccessKeyId
    • acl = 'private'
    • policy
    • signature
    • success_action_status = '201'

    Setting success_action_status to 201 causes S3 to return an XML document with HTTP status code 201. This is necessary to make the flash backend work. (The flash upload stalls when the response is empty and the code is 200 or 204. It results in an I/O error if the response is a redirect.)

  • S3 does not understand chunks, so remove the chunk_size config option.

  • unique_names can be either True or False, both work.