login about faq

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.")

asked Sep 02 '14 at 12:33

chilldll's gravatar image

chilldll
3631015

edited Sep 02 '14 at 14:41


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.

link

answered Sep 02 '14 at 13:55

chilkat's gravatar image

chilkat ♦♦
11.8k316358421

// This piece of code is picking the file from my local folder.

success = sftp.UploadFile(handle, "D:CSVTest.csv") If (success <> True) Then MsgBox(sftp.LastErrorText) Exit Sub End If

(Sep 02 '14 at 14:42) chilldll

My understanding is that, File which i need to upload has to be in the Server which has SSH User Account ?

(Sep 02 '14 at 15:21) chilldll

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.

link

answered Sep 03 '14 at 10:39

cdlvj130's gravatar image

cdlvj130
9691017

Chilkat explained me about, How to set the Absolute path? It works for me. I am able to set the destination folder.

(Sep 26 '14 at 10:36) chilldll
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×200
×90
×43
×33

Asked: Sep 02 '14 at 12:33

Seen: 1,291 times

Last updated: Sep 26 '14 at 10:36

powered by OSQA