How do I make Plupload upload directly to Amazon S3?

前端 未结 5 1992
野性不改
野性不改 2020-12-04 20:14

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

5条回答
  •  伪装坚强ぢ
    2020-12-04 20:48

    • 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.

提交回复
热议问题