How to get a file with <CFFTP>
i trying grab file , move coldfusion server using <cfftp> server in trying grab file sftp server. running coldfusion 8. when run code, dont error, blank white screen, yet file has not been moved. post code below, know doing wrong?
<!--- open conncetion 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>
<!--- 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>
things try:
1. value of localfile attribute should full path including name of file, not directory.
2. should able omit username , password in getfile cfhttp tag since you're using existing connection.
3. cf service have sufficient rights write files c:\wens_dev\pdf\ directory?
More discussions in ColdFusion
adobe
Comments
Post a Comment