Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Browser Based Uploads to Amazon S3?

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?

like image 374
chris Avatar asked Aug 06 '09 02:08

chris


2 Answers

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" />
like image 177
Alex Avatar answered Oct 09 '22 19:10

Alex


Browser-Based Uploads Using POST to Amazon S3

like image 43
410 Avatar answered Oct 09 '22 19:10

410