这可能是您的 HTML FORM 操作出现问题。
The action specifies the URL that processes the request, which must be set to the URL of the
bucket. For example, if the name of your bucket is "johnsmith", the URL
is "http://johnsmith.s3.amazonaws.com/".
请查看此 AMAZON S3 文档链接以了解更多详细信息:http://docs.amazonwebservices.com/AmazonS3/latest/dev/HTTPPOSTForms.html#HTTPPOSTFormDeclaration http://docs.amazonwebservices.com/AmazonS3/latest/dev/HTTPPOSTForms.html#HTTPPOSTFormDeclaration
还有另一篇文章对此进行了阐述。Amazon S3 - HTTPS/SSL - 可能吗? https://stackoverflow.com/questions/3048236/amazon-s3-https-ssl-is-it-possible
UPDATE:我能够使用此 HTML 和策略通过 SSL 将对象上传到 S3 存储桶。检查表单操作。
Policy :
{
"expiration": "2012-06-04T12:00:00.000Z",
"conditions": [
{"bucket": "<YourBucketName>" },
{"acl": "public-read" },
["eq", "$key", "testImage.jpg"],
["starts-with", "$Content-Type", "image/jpeg"],
]
}
HTML:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<form action="https://s3.amazonaws.com/<YourBucketName>/" method="post" enctype="multipart/form-data">
<input type="text" name="key" value="testImage.jpg" />
<input type="text" name="acl" value="public-read" />
<input type="text" name="content-type" value="image/jpeg" />
<input type="hidden" name="AWSAccessKeyId" value="<YOUR ACCESS KEY>" />
<input type="hidden" name="policy" value="<YOUR GENERATED POLICY>" />
<input type="hidden" name="signature" value="<YOUR GENERATED SIGNATURE>" />
<input name="file" type="file" />
<input name="submit" value="Upload" type="submit" />
</form>
</body>
</html>
您必须知道如何生成编码策略和签名。