【发布时间】:2021-11-24 13:00:57
【问题描述】:
我必须制作一个预定的脚本/cfm,从某个文件位置下载图像(没问题),然后将其上传到我们的 amazon s3 位置(问题)。 这可能吗?如果可以,怎么办?下载没问题,文件存储在临时文件夹中。 我如何/可以将此文件获取到 Amazon s3?
到目前为止我试过了:
- 下载文件时直接存储在s3上:
<cfhttp method="get" url="#cimage#" path="https://s3-eu-west-1.amazonaws.com/ourfilelocation/" file="#theimage#" />
给我错误'这是一个只读资源,无法写入'
- 首先将其下载到临时文件位置,然后在新的 cfhttp 中上传到 s3:
<cfhttp method="get" url="#cimage#" path="#tmpfileloc#" file="#theimage#" />
<cfhttp method="post" url="https://s3-eu-west-1.amazonaws.com/ourfilelocation/" path="#tmpfileurl#" file="#theimage#" />
给我错误'405 Method Not Allowed'
3.
<cffile action="upload" file="#tmpfileurl#/#theimage#" destination="https://s3-eu-west-1.amazonaws.com/ourfilelocation/">
这当然给了我“没有用这个表格发送文件”,因为没有表格
4.
<cfhttp method="post" url="https://s3-eu-west1.amazonaws.com/ourfilelocation">
<cfhttpparam type="file" name="#theimage#" file="#tmpfileurl#/#theimage#"> </cfhttp>
给我“连接失败”。状态码不可用。我想您不能只发布到该网址,这没有任何意义。但我不知道你是否有办法。
【问题讨论】:
-
请编辑问题以显示您尝试过的内容。还要详细说明问题。
-
@DanBracuk 更新
-
我们仍然使用 CF2016 (Win) 并依赖使用 S3 Express (CLI) 来实现我们的后台复制功能。它支持更多的 S3 功能,多线程(速度更快)并且在传输非常大的文件时没有任何问题。
标签: amazon-s3 coldfusion coldfusion-2016