Problem with a Vb app and runing the Winscp script

Advertisement

EdDmp
Joined:
Posts:
1
Location:
NY

Problem with a Vb app and runing the Winscp script

Hi
I get the following error when I try to upload a file:
Error: Cannot create remote file '/MySftp.com/files/path/Test/uplaod.txt'.
Permission denied.
Error code: 3
Error message from server: Can not create /MySftp.com/files/path/Test/uplaod.txt

Can someone tell me what this truly means and what I can do about it.

Here is the code that I have in the VB.Net application:

Dim sessionOptions As New SessionOptions
        Dim Filename As String = "C:\Users\ed.walsh\Desktop\ftp\*.txt"
        Dim uploadFolder As String = "/us1.hostedftp.com/files/path/Testing/*"

        With sessionOptions
            .Protocol = Protocol.Sftp
            .HostName = "MySftp.com"
            .UserName = "My User name"
            .Password = "My pass"
            .SshHostKeyFingerprint = "ssh-dss bbbb xxxxxxxxxxxxxxxxxxxxxxxxxxx="
            .AddRawSettings("FSProtocol", "2")
            .PortNumber = 22
        End With

        Using session As New WinSCP.Session
            session.Open(sessionOptions)

            Dim transferOptions As New WinSCP.TransferOptions
            transferOptions.TransferMode = WinSCP.TransferMode.Binary

            Dim transferResult As WinSCP.TransferOperationResult
            transferResult = session.PutFiles(Filename, uploadFolder, False, transferOptions)

            transferResult.Check() 'THrows the first error if not successful 

            For Each transfer As WinSCP.TransferEventArgs In transferResult.Transfers
                'Write results to Event Viewer or SQL table or Log Table 
                'This will display a message box with the results 
                MessageBox.Show(“Upload of file “ & transfer.FileName & ” successful.”)
            Next

        End Using

Reply with quote E-mail

Advertisement

Advertisement

You can post new topics in this forum