views:

350

answers:

2

Amazon has instructions on how to write a form that posts directly to Amazon's S3 service via HTML POST. However, they are not very clear on how to create a simple form to upload directly to an S3 bucket, and never give an actual example html file...

Is there a good example available where I can view the sample code?

A: 

Browser-Based Uploads Using POST to Amazon S3

PhantomTypist
Yes, the amazon instructions from the winning answer are the problem i'm having.
chris
+3  A: 

Here is a piece of html code from the aforementioned doc. I think it's self explanatory but let me know if you're having any troubles.

  <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" />
Alex
thanks for the message Alex. I got it work. Do you know if this can be implemented using swfupload? If so, is there any sample code anywhere I could get? I've tried googling but no luck
chris