Archived Forum Post

Index of archived forum posts

Question:

FTP - Destination Folder

Sep 26 '14 at 10:36

I am able to get my sample code work sucessful. No Error and results as Succeed. But, I am not able to see the file in the FTP Folder. What could be the reason? Do i miss the Destination Folder file path ?

 Dim filepath As String 
 filepath = "NameoftheFile_Test.csv"

 ' HostName, PortNumber, UserName, Password - Given Correctly - Succeed

 '  Upload from the local file to the SSH server.
        success = sftp.UploadFile(handle, "D:\CSV\Test.csv")
        If (success <> True) Then
            MsgBox(sftp.LastErrorText)
            Exit Sub
        End If

        '  Close the file.
        success = sftp.CloseHandle(handle)
        If (success <> True) Then
            MsgBox(sftp.LastErrorText)
            Exit Sub
        End If
        MsgBox("Success.")

Answer

Your examples shows SFTP (Secure File Transfer over SSH). You are missing the critical piece of information: the handle passed to UploadFile was received from a call to OpenFile. The path used in the call to OpenFile is where the file is located on the server. It is likely a path relative to the HOME directory of your SSH user account.


Answer

pretty much all ftp servers use a virtual folder scheme, and one is not allowed to simple access to the Drive. I agree you should have received an error.

For this protocol, you have to retrieve the absolute path or relative path to build your copy instruction.

It really would be nice that SFTP and the FTP blocks be combined into one module. It would all be coded the same, you do a change directory, and Chilkat would figure out where to write the file.