Post a reply

Options
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)

Options

Topic review

martin

Re: Errror trying to upload file using vb.net Code

The correct syntax is:

transferResult = mySession.PutFiles("\\aiken\ProdCognos\ITExtracts\studentlist.csv", "/studentlists/", False, myTransferOptions)

As documented:
https://winscp.net/eng/docs/library_session_putfiles
Swindellvc@cofc.edu

Errror trying to upload file using vb.net Code

I'm trying to upload a file and I'm getting

Error:Cannot overwrite remote file '/studentlists'.$$ <which is the directory on the upload and is empty when testing code
Press 'Delete' to delete the file and create a new one instead of overiting it. $$



I'm using the VBA code...
is there a way to overwite an existing file?
or sync a single file using VB?



blah blah blah for SessionOptions

mySession.Open(mySessionOptions)

' Upload files
Dim myTransferOptions As New TransferOptions
myTransferOptions.TransferMode = TransferMode.Binary

Dim transferResult As TransferOperationResult
transferResult = mySession.PutFiles("\\aiken\ProdCognos\ITExtracts\studentlist.csv", "\studentlists", False, myTransferOptions)

' Throw on any error
transferResult.Check()

' Display results
Dim transfer As TransferEventArgs
For Each transfer In transferResult.Transfers
MsgBox("Upload of " & transfer.FileName & " succeeded")
Next