【问题标题】:How to copy a file via the browser to Amazon S3 using Python (and boto)?如何使用 Python(和 boto)通过浏览器将文件复制到 Amazon S3?
【发布时间】:2011-01-05 23:32:17
【问题描述】:

使用 Python(和 boto)在 Amazon S3 中创建文件(密钥)不是问题。 使用此代码,我可以连接到存储桶并创建具有特定内容的密钥:

bucket_instance = connection.get_bucket('bucketname')
key = bucket_instance.new_key('testfile.txt')
key.set_contents_from_string('Content for File')

我想通过浏览器(文件对话框)将文件上传到 Amazon S3。

如何使用 boto 实现这一点?

提前致谢

【问题讨论】:

    标签: python google-app-engine amazon-s3 amazon-ec2 boto


    【解决方案1】:

    您不能使用 boto 执行此操作,因为您要求的是纯粹的客户端 - 除了生成要发布的表单之外,服务器没有直接参与。

    您需要使用亚马逊的browser-based upload with POST 支持。 here有一个演示。

    【讨论】:

    • 这就是解决方案。我不知道上传纯粹是客户端。非常感谢!
    【解决方案2】:

    你是说这个吗? Upload files in Google App Engine

    【讨论】:

    • 不,我有一个在 Google App Engine 上运行的应用程序 (python + boto 1.9b)。我想实现,用户可以通过 HTML 表单(文件对话框)将文件从他们的客户端上传到他们的 S3 存储桶中。
    猜你喜欢
    • 2011-01-07
    • 2014-12-16
    • 2011-10-10
    • 1970-01-01
    • 2012-08-31
    • 1970-01-01
    • 2013-05-22
    • 2019-06-19
    • 1970-01-01
    相关资源
    最近更新 更多