如何让 Plupload 直接上传到 Amazon S3? [英] How do I make Plupload upload directly to Amazon S3?

查看:29
本文介绍了如何让 Plupload 直接上传到 Amazon S3?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何正确配置 Plupload 以便将文件直接上传到 亚马逊 S3?

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

推荐答案

  • 除了bucket、key 和acl 的条件外,策略文档还必须包含name、Filename 和success_action_status 的规则.例如:

    • 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 是 Fl​​ash 后端发送的字段,但 HTML5 后端不发送.

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

      multipart 设置必须为 True,但这是目前的默认设置.

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

      multipart_params 设置必须是具有以下字段的字典:

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

      • key
      • AWSAccessKeyId
      • acl = 'private'
      • 政策
      • 签名
      • success_action_status = '201'

      success_action_status 设置为 201 会导致 S3 返回一个带有 HTTP 状态代码 201 的 XML 文档.这是使闪存后端工作所必需的.(当响应为空且代码为 200 或 204 时,闪存上传停止.如果响应是重定向,则会导致 I/O 错误.)

      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 不理解块,因此删除 chunk_size 配置选项.

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

      这篇关于如何让 Plupload 直接上传到 Amazon S3?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆