Topic "Error when copying file to sftp using"

Author Message
[View user's profile]

Joined: 2013-08-20
Posts: 1
Location: Melbourne
With the same login detail I can login to the server using WINSCP but getting error when doing it through
I am trying to copy the file to a sftp location but getting error the code I am using is:

' Setup session options
Dim sessionOptions As New SessionOptions
With sessionOptions
.Protocol = Protocol.Sftp
.HostName = remotehost
.UserName = username
.Password = password
.SshHostKeyFingerprint = "ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"
End With
Using session As Session = New Session
' Connect
' Upload files
Dim transferOptions As New TransferOptions
transferOptions.TransferMode = TransferMode.Automatic
Dim transferResult As TransferOperationResult
transferResult = session.PutFiles(filename, remotefolder, False, transferOptions)
' Throw on any error
If transferResult.IsSuccess Then
errmsg = "Upload succeeded"
Return True
' Print results
Dim transfer As TransferEventArgs
For Each transfer In transferResult.Transfers
errmsg = "ERROR file transfer - sending " & transfer.FileName
End If
End Using
Catch e As Exception
errmsg = "ERROR session - " & e.Message
Return False
End Try

I am getting error at "transferResult.Check" the error is as follows:

"A first chance exception of type 'WinSCP.SessionRemoteException' occurred in WinSCP.dll
Cannot create remote file '/tCONF_MF_IN/con_mf_80063589_20130816100833.DAT'"

Please help!!!
[View user's profile]

Joined: 2013-07-24
Posts: 13
Location: Sunny Southern California

I understand you can login to the server manually, but once in can you actually create a file? This sounds like a permissions issue.

[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26890
Location: Prague, Czechia
Checking (or posting here if you cannot help yourself) a session log (Session.SessionLogPath) file may provide more hints.
Also note that the exception likely has an inner exception associated, with more details.

You can post new topics in this forum


What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!


About donations

$9   $19   $49   $99

About donations


WinSCP Privacy Policy

WinSCP License