[英]Pre-signed url for multiple files boto3
after finding a solution for multiple files I came to know a solution which look like this在找到多个文件的解决方案后,我开始知道一个看起来像这样的解决方案
response = s3.generate_presigned_post(
"BUCKET_NAME",
"uploads/${filename}",
Fields=None,
Conditions=[["starts-with", "$key", "uploads/"]],
ExpiresIn=(10 * 60),
)
so now scenario is I am creating a folder on fly.所以现在的情况是我正在动态创建一个文件夹。 like here my folder will be like upload/bulk_upload
here I will allow user to upload multiple files.像这里一样,我的文件夹将像upload/bulk_upload
一样,我将允许用户上传多个文件。 so In this code how I will do this?所以在这段代码中我将如何做到这一点? what will ${filename}
as files will be dynamic and what is $key
in my case?什么${filename}
作为文件将是动态的,在我的情况下$key
是什么? Confuse where I have to change to make this program run according to my wish混淆我必须改变的地方才能使这个程序按照我的意愿运行
what will ${filename} as files will be dynamic ${filename} 文件将是动态的
You can't do this.你不能这样做。 ${filename}
can't be dynamic and you must specify it upfront when you generate generate_presigned_post
. ${filename}
不能是动态的,您必须在生成generate_presigned_post
时预先指定它。 So you have to run generate_presigned_post
for each file you are going to upload.因此,您必须为要上传的每个文件运行generate_presigned_post
。
For example, if you want to upload 100 files of different ${filename}
, you have to run 100 generate_presigned_post
.例如,如果要上传 100 个不同的${filename}
,则必须运行 100 generate_presigned_post
。
what is $key in my case在我的例子中 $key 是什么
$key
is a constant. $key
是一个常量。 You don't change it.你不改变它。 It is literal string $key
.它是文字字符串$key
。 Its part of the syntax.它是语法的一部分。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.