Jump to content


Photo

Coding SSH FTP Uploads in VB6


This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1 Rob N.

Rob N.
  • Members
  • 14 posts

Posted 07 March 2011 - 04:48 PM

I am attempting to do a VB6 App that will upload a file using SSH FTP. This is on a Windows 7, 32-Bit machine, running VB6 sp6, and the SmartFTP 2.0 Type Library. I'm new when it comes to coding FTP processes, so a little green. I am using the code sample for VB6 to create a simple app that will test the feasibility of what I'd like to do. When I step through the code the connection method (objSSH.Connect) errors with a LastError value of 25. Is there any type of documentation which details what these codes mean? When I attempt to set the LogFile property in code I get the "Object doesn't support this property or method" error. My code is below:

Public objSSH As sfFTPLib.SSHConnection
Public objSFTP As sfFTPLib.SFTPConnection
Public objGlobal As sfFTPLib.Global


Set objGlobal = CreateObject("sfFTPLib.Global")

Dim strKey As String

'strKey = strKey & "<?xml version=""1.0"" ?>" & Chr(13) & Chr(10)
'strKey = strKey & "<License>" & Chr(13) & Chr(10)
'strKey = strKey & "<Version>2.0</Version>" & Chr(13) & Chr(10)
'strKey = strKey & "<Id>400012345</Id>" & Chr(13) & Chr(10)
'strKey = strKey & "<Name>Robert Nash</Name>" & Chr(13) & Chr(10)
'strKey = strKey & "<Email>******@****.com</Email>" & Chr(13) & Chr(10)
'strKey = strKey & "<Company"


Set objSSH = CreateObject("sfFTPLib.SSHConnection")
objSSH.Host = "elink-sshftp.*******.com"
objSSH.Port = 22
objSSH.Username = "MFRI-----"
objSSH.Password = "*******"
objSSH.UseMessageLoop = True


'objSSH.LogFile = "<FileName.log"
'If objSSH.Connect = ftpErrorSuccess Then
If objSSH.Connect = ftpErrorSuccess Then
SFTPTest
objSSH.Disconnect
Else
MsgBox ("Connect() failed.")
End If

Along these lines, does anyone know of a good resource with sample VB6 code for programmatically doing uploads and downloads?

Any help is appreciated, thank you

#2 mb

mb

    Developer

  • Administrators
  • 11521 posts

Posted 07 March 2011 - 04:53 PM

The documenation is included in the setup:
http://www.smartftp....ftplib/download

25 means ftpErrorConnect

Did you try this line?
objSSH.LogFile.File = "VB6Demo.log"

And have you seen the sample (Samples/SFTP/VB6) in the setup?