在 S3 中生成下载文件夹的链接 [英] Generate link to download folder in S3
问题描述
我设置了网站,您可以在其中将文件发送到 Amazon S3 云存储.多个文件可以存储在这样的文件夹中:
I have setup website where you can send files to Amazon S3 cloud storage. Multiple files can be stored in folders like so:
my_bucket/folder1/file1.txt
my_bucket/folder1/file2.txt
现在我正在尝试为用户生成下载整个 folder1
的链接,我发现这很难做到.有什么我想念的吗?尝试使用 getObjectUrl("mybucket", "folder1")
为 folder1
生成 url 给我错误.
Now I am trying to generate link for user to download whole folder1
which I found weirdly hard to do. Is there something I am missing? Trying to generate url using getObjectUrl("mybucket", "folder1")
for folder1
is giving me error.
还有一种方法可以使生成的 URL 不是看起来像这样:
Also is there a way I could make generated URL not to look like this:
https://my_bucket.s3.amazonaws.com/file1.txt
但更适合一般公众使用的东西?
but something that is more appropriate for a general public usage?
推荐答案
S3 没有这个功能.您需要压缩要提供链接的所有文件,将 zip 文件放在 S3 上,然后生成指向该文件的链接.
S3 does not have this feature. You would need to zip up all the files you want to provide a link for, put the zip file on S3, and then generate a link to that.
这篇关于在 S3 中生成下载文件夹的链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!