Amazon提供了有关如何编写通过 HTML POST 直接发布到 Amazon 的 S3 服务的表单的说明。但是,他们不太清楚如何创建一个简单的表单以直接上传到 S3 存储桶,并且从未给出实际的示例 html 文件......
是否有可以查看示例代码的好示例?
这是来自上述文档的一段 html 代码。我认为这是不言自明的,但如果您遇到任何麻烦,请告诉我。
<form action="http://johnsmith.s3.amazonaws.com/" method="post" enctype="multipart/form-data">
Key to upload: <input type="input" name="key" value="user/eric/" /><br />
<input type="hidden" name="acl" value="public-read" />
<input type="hidden" name="success_action_redirect" value="http://johnsmith.s3.amazonaws.com/successful_upload.html" />
Content-Type: <input type="input" name="Content-Type" value="image/jpeg" /><br />
<input type="hidden" name="x-amz-meta-uuid" value="14365123651274" />
Tags for File: <input type="input" name="x-amz-meta-tag" value="" /><br />
<input type="hidden" name="AWSAccessKeyId" value="15B4D3461F177624206A" />
<input type="hidden" name="Policy" value="POLICY" />
<input type="hidden" name="Signature" value="SIGNATURE" />
File: <input type="file" name="file" /> <br />
<!-- The elements after this will be ignored -->
<input type="submit" name="submit" value="Upload to Amazon S3" />
S3 上 POST的当前文档很好地解释了这一点。(这个帖子有点过时了)
有一个使用 swfupload 的非常基本的上传实用程序。https://github.com/cyberbuff/ZenS3
免责声明:我开发了它。