gpt4 book ai didi

php - 从浏览器直接上传到S3(亚马逊)和https麻烦

转载 作者:搜寻专家 更新时间:2023-10-31 20:39:25 25 4
gpt4 key购买 nike

我创建了一个页面,用户可以从中上传他们的文件。此代码片段将这些文件发送到我的 Amazon S3 存储桶。

<form action="https://BUCKET.s3-eu-west-1.amazonaws.com/" method="post" enctype="multipart/form-data">
<input type="hidden" name="awsAccessKey" value="ACCESS_KEY">
<input type="hidden" name="awsSecretKey" value="SECRET_KEY">
<input type="hidden" name="acl" value="private">
<input type="hidden" name="policy" value="POLICY">
<input type="hidden" name="signature" value="SIGNATURE">
<input type="hidden" name="Content-Type" value="">
<!-- 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>

一切正常,但我遇到了 https 问题。主要浏览器不信任 s3-eu-west-1.amazonaws.com 并显示有关不可信连接的安全消息。

我将 HTTPS 连接更改为 HTTP,这样我的客户就不会遇到任何问题。有人对如何解决此问题有任何想法吗?

最佳答案

很可能您的存储桶名称中有一个点。 Amazon 的 S3 通配符证书仅适用于一级子域,因此 bucket.s3-eu-west-1.amazonaws.com 可以,但 bucket.bucket.s3-eu-west- 1.amazonaws.com 不是。改用这个:

https://s3-eu-west-1.amazonaws.com/BUCKET/

关于php - 从浏览器直接上传到S3(亚马逊)和https麻烦,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26810062/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com