• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How can you FTP with SSH using CF 7?

Explorer ,
Mar 22, 2007 Mar 22, 2007

Copy link to clipboard

Copied

We're migrating content to new servers that require SSH connection for FTP.

Currently the CF code uses CFFTP tag to transfer files from the test to production servers; but what will I need to do to have the CF code transfer files over SSH?

The servers are using CF version 7 and run on IIS.

Thank you,
Josh
TOPICS
Advanced techniques

Views

1.5K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Mar 23, 2007 Mar 23, 2007

Copy link to clipboard

Copied

You don't! Maybe in CF8, but not with cf7.

I used a custom tag called cfx_SecureFTP and cfx_SecureFTP. Can't find them anymore on Google, but I could email you what I have.

OR maybe this would work for you:
http://www.jscape.com/sftp/index.html
" did this just recently for a client. We implemented a fairly simple
solution using Jscape Secure FTP Factory for Java. It works well, however I
was not able to get listeners to work, so reporting on successfully
transfers is not great. I do a directory listing after the upload and look
for the file I just uploaded. This works in my case, because the file name
is always unique. Might not work for you. Maybe you can find a better way.
The url is http://www.jscape.com/sftp/index.html it costs $499.00.

This is the code we used to implement it:

<cfset jarpath = 'C:\CFusionMX7\wwwroot\WEB-INF\lib\sftp.jar'>


<cfscript>

system = CreateObject("java", "java.lang.System");
classpath = system.getProperty("java.class.path");
if (FindNoCase("sftp", classpath) LTE 0)
{
classpath = classpath & ";#jarpath#";
system.setProperty("java.class.path",classpath);
}


util = CreateObject("java", "com.jscape.inet.ssh.util.SshParameters");
sLogin =
util.init('#dailyftp_profiles.ftpaddress#','#dailyftp_profiles.username#','#dailyftp_profiles.
password#');
sftpObject = CreateObject("java", "com.jscape.inet.sftp.Sftp");
sftp = sftpObject.init(sLogin);

// connect and set timeout
sftp.connect();
sftp.setTimeout(1000);

// set remote directory if requested
if (#dailyftp_profiles.homedirectory# neq ''){
sftp.setDir("#dailyftp_profiles.homedirectory#");
}

sftp.setAuto(true);
// upload the file
sftp.upload("#request.general_tempfile_root##tempfilename#");
sftp.renameFile("#tempfilename#","#remoteFileName#");
//get listing
dirListing2 = sftp.getDirListingAsString();
// disconnect from SSH server
sftp.disconnect();
</cfscript>

<!--- check that the file was uploaded --->
<cfif not dirListing2 contains '#remoteFileName#'>
<!--- do error handling here for failed upload --->
</cfif>

from link:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:234022

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 22, 2010 Jul 22, 2010

Copy link to clipboard

Copied

LATEST

Neo Rye -

I was also using a custom tag "cfx_SecureFTP" on ColdFusion MX7 for FTP uploading. I have no idea where it came from because it was set up by my predecessor.

Now I've upgraded to ColdFusion 9 and that custom tag won't work any more. Any ideas on why that might be?

Thanks!

-Jessie

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation