<html>
<head>
<title>S3 POST Form</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<form action="https://s3-bucket.s3.amazonaws.com/" method="post" enctype="multipart/form-data">
<input type="hidden" name="key" value="uploads/${filename}"> <input type="hidden" name="AWSAccessKeyId" value="YOUR_AWS_ACCESS_KEY">
<input type="hidden" name="acl" value="private">
<input type="hidden" name="success_action_redirect" value="http://localhost/">
<input type="hidden" name="policy" value="YOUR_POLICY_DOCUMENT_BASE64_ENCODED">
<input type="hidden" name="signature" value="YOUR_CALCULATED_SIGNATURE">
<input type="hidden" name="Content-Type" value="image/jpeg">
<! Include any additional input fields here >
File to upload to S3: <input name="file" type="file">
<br>
<input type="submit" value="Upload File to S3">
</form>
</body>
</html>
然后,添加一个策略文档
S3 POST forms include a policy document that authorizes the form and
imposes limits on the files that can be uploaded. When S3 receives a
file via a POST form, it will check the policy document and signature
to confirm that the form was created by someone who is allowed to
store files in the target S3 account.
To complete your S3 POST form, you must sign it to prove to S3 that
you actually created the form. If you do not sign the form properly,
or if someone else tries to modify your form after it has been signed,
the service will be unable to authorize it and will reject the upload.
是的,S3接受通过精心编制和预先授权的HTML POST表单上传。您可以在任何网页中包含这些表单,以允许您的网站访问者只使用标准的web浏览器向您发送文件。你知道吗
看看S3 POST Upload
归根结底,要创建这样一个窗体:
然后,添加一个策略文档
最后,签署你的发帖请求
相关问题 更多 >
编程相关推荐