gsr
04/18/2023, 3:33 AM<cffile file="#arguments.pathS3##uploadedfile#" action="readbinary" variable="myData">
encrypted=encryptBinary(myData, theKey, 'AES');
<cffile file="#arguments.pathS3##uploadefile#" action="write" output="#encrypted#" />
i converted it to a function, but i am confused on the last part where it is writing back to the s3 bucket
public function fetchAndWrite(any resources) {
var checkForFile = objectFileExists(resources.clientID,resources.ifile,resources.location,resources.secure);
if(checkForFile) {
results = fetchFile(clientID=resources.clientID,rawFile="1",gameSheet="#resources.ifile#");
}
if(resources.read) {
cffile( variable="myData", file="#results#", action="info" );
cffile( output="#encrypted#", file="#results#", action="write" );
}
return myData;
}
or should i use amazons3 like renameobject of amazonsdkAdam Cameron
checkForFile is false, why are you even continuing? Is that right? If the file isn't there, you want to halt and throw an exception don't you?
You are not var-ing all your variables.
If resources.read is false, where does myData come from?
You don't need to quote-and-pound your parameters. file=results is fine. file="#results#" is just more typing, and less clear.
So my guidance:
Start again, slow down, work iteratively, consider using automated tests, nail each bit first, then move onto the next bit once the preceding bit is working. Make sure all earlier bits continue to work as expect whilst tinkering with subsequent bits.
Oh, and don't leave us guessing about things like "i am confused". Articulate yourself more thoroughly. Although this is a big improvement on some of your erstwhile questions, so well done for working on it.zackster
04/18/2023, 7:29 AMAdam Cameron
gsr
04/18/2023, 5:38 PM