Neverland
Neverland

Reputation: 775

How to copy a file via the browser to Amazon S3 using Python (and boto)?

Creating a file (key) into Amazon S3 using Python (and boto) is not a problem. With this code, I can connect to a bucket and create a key with a specific content:

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

I want to upload a file via the browser (file dialogue) into Amazon S3.

How can I realize this with boto?

Thanks in advance

Upvotes: 1

Views: 554

Answers (2)

Nick Johnson
Nick Johnson

Reputation: 101149

You can't do this with boto, because what you're asking for is purely client-side - there's no direct involvement from the server except to generate the form to post.

What you need to use is Amazon's browser-based upload with POST support. There's a demo of it here.

Upvotes: 2

Dyno Fu
Dyno Fu

Reputation: 9044

do you mean this one? Upload files in Google App Engine

Upvotes: 0

Related Questions