I have to make a scheduled script/cfm that downlaods an image from a certain file location (no problem) and then uploads it to our amazon s3 location (problem). Is this possible and if so how? Downlaod is ok, and file is stored in a temp folder. How do I/can I get this file to Amazon s3?
Sofar I tried :
- Store on s3 directly when downloading the file :
<cfhttp method="get" url="#cimage#" path="https://s3-eu-west-1.amazonaws.com/ourfilelocation/" file="#theimage#" />
giving me the erorr 'this is a read-only resource, can't write to it'
- First download it to a temp file location and then in a new cfhttp upload to 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#" />
giving me the error '405 Method Not Allowed'
3.
<cffile action="upload" file="#tmpfileurl#/#theimage#" destination="https://s3-eu-west-1.amazonaws.com/ourfilelocation/">
which ofcourse gives me 'no file send with this form' because there is no form
4.
<cfhttp method="post" url="https://s3-eu-west1.amazonaws.com/ourfilelocation">
<cfhttpparam type="file" name="#theimage#" file="#tmpfileurl#/#theimage#"> </cfhttp>
giving me 'Connection Failure. Status code unavailable.' I guess you cannot just post to that url, it makes no sense. But I wouldn't know if there is a way in which you could.