Copy link to clipboard
Copied
I am trying to grab a file and move it to the coldfusion server using <CFFTP> The server in which I am trying to grab the file is a sftp server. I am running coldfusion 8. When I run my code, I dont get an error, I just get a blank white screen, yet the file has not been moved. I will post my code below, does anyone know what I am doing wrong?
<!--- Open conncetion with remote sftpserver --->
<cftry>
<cfftp action="open"
connection="ftpServer"
server="server.com"
username = "username"
password = "password"
fingerprint = "11:11:B5:F2:11:AF:C2:E2:31:11:D3:B4:11:83:11:11"
timeout="20"
port="22"
secure = "yes" />
<cfcatch>
<cfset throwFileTransferFailed("Could not open connection. Message: " & cfcatch.Message & ". Detail: " & cfcatch.Detail)>
</cfcatch>
</cftry>
<!--- get the file --->
<cftry>
<cfftp
action="getFile"
connection="ftpServer"
server="server.com"
username="username"
password="password"
remotefile="TEST_20100816.csv"
localfile="C:\WENS_DEV\pdf\"
failIfExists="no">
<cfcatch>
<cfset throwFileTransferFailed("Could not open connection. Message: " & cfcatch.Message & ". Detail: " & cfcatch.Detail)>
</cfcatch>
</cftry>
Copy link to clipboard
Copied
Things to try:
1. The value of localfile attribute should probably be a full path including the name of the file, not just a directory.
2. You should be able to omit the username and password in the getFile CFHTTP tag since you're using an existing connection.
3. Does the CF service have sufficient rights to write files to the C:\WENS_DEV\pdf\ directory?
Copy link to clipboard
Copied
how do I tellif the CF service has sufficient rights?
Now my code looks like this and I am still getting an error. I cant figure it out.
<cfftp action="open"
connection="ftpServer"
server="server.com"
username = "username"
password = "password"
fingerprint = "11:11:11:11:11:11:11:11:11"
timeout="30"
port="22"
secure = "yes" />
<cfftp
action="getFile"
connection="ftpServer"
remotefile="TEST_20100816.csv"
localfile="C:\WENS_DEV\pdf\TEST_20100816.csv"
failIfExists="no">
Copy link to clipboard
Copied
After you open the ftp connection, try a listdir. If nothing else it should tell you that your connection was successful and what's available on the other end.
Copy link to clipboard
Copied
crap, I didthat and it is still not working.
Here is my code for the listdir
<cfftp action="LISTDIR"
stoponerror="yes"
name="client_file"
directory="/"
connection="ftpServer">
<cfoutput query="client_file">
#LAST_NAME#<br />
</cfoutput>
Copy link to clipboard
Copied
The results of a listDir CFFTP call, which is a query object, would not contain a "LAST_NAME" column. See the CF docs for more info.
http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Tags_f_20.html#3490627
What are you trying to accomplish here?
Copy link to clipboard
Copied
When troubleshooting, cfdump is a much better tag to use than cfoutput.
Copy link to clipboard
Copied
The CF account runs under a user login or account of some kind. The terminology would depend on the operating system you are using. Are you using Windows or *nix?
What error message(s) are you receiving?
Copy link to clipboard
Copied
I am using windows.
Here is the kicker, I am in a new position, working in someone elses system, and the way it is set up, no matter what error accurs, a nice little friendly error with the company logo pops up. I can't see anything. Even when I use <Try> <catch>, I get nothing.
I will certainly be bald before this is over.
Copy link to clipboard
Copied
IF you have access to the ColdFusion logs, either through the administrator OR through a network file system, you could look up the copy of the error that ColdFusion stores, even though it is not being displayed in the browser.
ALSO, depending on how they are causing that friendly error with the company logo, you may be able to circumvent it with an <CFABORT> tag.
Copy link to clipboard
Copied
Checking the logs is a great idea, I will do that. Ill bet the answer is in there. Thanks everyone!
Copy link to clipboard
Copied
If you have access to the CF Administrator, you can add your IP address to the list of addresses that display verbose error messages rather than the useless ones that typical end users might see.