Post a reply

Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)


Topic review


Problem with a Vb app and runing the Winscp script

I get the following error when I try to upload a file:
Error: Cannot create remote file '/'.
Permission denied.
Error code: 3
Error message from server: Can not create /

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 = "/*"

        With sessionOptions
            .Protocol = Protocol.Sftp
            .HostName = ""
            .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

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

        End Using