Copy link to clipboard
Copied
Hello all, I am trying to use the cfftp tag to connect to another server to upload some files. The server that we are connecting to does not have passive transfer activated. We are on Amazon Web Services, Windows Server 2008 and Coldfusion 10. We we try to transfer files we get the following:
Detail: Error: 500 I won't open a connection to xxx.xxx.xxx.253 (only to xxx.xxx.xxx.247)
.253 is the internal, private IP and .247 is the public IP. Basically both of these ip's are assigned to the same machine. I suspect it has to do with firewall security settings. Can anyone help?
Here is the code:
<cftry> | |||||
<cfftp action="open" | |||||
connection="ftpServer" | |||||
server="#variables.IP#" | |||||
username="username" | |||||
password="password!" | |||||
timeout="60" | |||||
retrycount="10" | |||||
transfermode="auto" | |||||
/> | |||||
<cfcatch> | |||||
<cfset throwVoiceFileTransferFailed("Could not open connection. Message: " & cfcatch.Message & ". Detail: " & cfcatch.Detail)> | |||||
</cfcatch> | |||||
</cftry> | |||||
<cftry> | |||||
<cfftp action="putFile" | |||||
connection="ftpServer" | |||||
localFile="#this.getDefaultPath() & this.getFileName()#" | |||||
remoteFile="#this.getFileName()#" /> | |||||
<cfcatch> | |||||
<cfset throwVoiceFileTransferFailed("Could not put file. Message: " & cfcatch.Message & ". Detail: " & cfcatch.Detail)> | |||||
</cfcatch> | |||||
</cftry> | |||||
<!--- No need to transfer the file if it already exists ---> | |||||
<cfif This.getIntroMessage() neq "" and Not This.introFileIsOld()> | |||||
<cftry> | |||||
<cfftp action="putFile" | |||||
connection="ftpServer" | |||||
localFile="#This.getIntroFilePath()#" | |||||
remoteFile="intros/#This.getIntroFileName()#" | |||||
timeout="60" | |||||
retrycount="10" | |||||
transfermode="auto" | |||||
/> | |||||
<cfcatch> | |||||
<cfset throwVoiceFileTransferFailed("Could not put intro file. Message: " & cfcatch.Message & ". Detail: " & cfcatch.Detail)> | |||||
</cfcatch> | |||||
</cftry> | |||||
</cfif> |
Copy link to clipboard
Copied
Hi, sdettling222‌,
For future reference, whenever you include code in a post, please remember to highlight the code after you insert it, and use the ">>" button in the advanced editor to select "Syntax Highlighting", which will condense the code and make it a little more readable.
Hightlighted code
looks like
this
Meanwhile, I suspect that your assessment (firewall security) of the situation is most likely correct.
HTH,
^_^
Copy link to clipboard
Copied
Five suggestions:
1) Specify the port
action="open"
connection="ftpServer"
server="#variables.IP#"
port="9876"
username="username"
password="password!"
2) Open the port in your corporate firewall or ask your SysAdmin to do so.
3) Set the passive flag to true
action="putFile"
connection="ftpServer"
passive="true"
4) Use just one try-catch for all the sections of code
5) Shut the door after you. At the very end, close the FTP connection
<cfftp action = "close"
connection = "ftpServer"
stopOnError = "Yes">