Topic "Cannot create remote file- Permission denied"

Author Message
Guest




I am using WinSCP Version 5.11.2 (Build 7781)
OS is Windows 7 Enterprise- (OS 6.1.7601 Service Pack 1)

I am trying to upload 1 file to a subdirectory.
I am able to do this using the WinScp client tool.

however, when I try to put it in a code (VB6) I am getting a "cannot create remote file" "permission denied" error.

I have tried multiple variations of remote file path,s transferOptions.FilePermissions , and transferOptions.FileMask = "*.*" to no avail.

Also, as I said, manually transferring the file works fine, so it is not a permissions problem.

I have generated a log of the manual transfer, but I don't see what I am missing (a side issue is, the log shows WinScp is listing all of the files in the subfolder, and it takes some time to do this, why is it reading all the files in the subfolder?? can it just put the file in there?).


The code is:

Dim session As WinSCPnet.session
Dim sessionOptions As WinSCPnet.sessionOptions
Dim transferOptions As WinSCPnet.transferOptions
Dim transferResult As TransferOperationResult

Dim longFilenameLocal As String
Dim remoteFilePath As String

remoteFilePath = "/app_home/GL.INTERFACES/CSTEST2.TXT"

longFilenameLocal = "C:\local\datatel\RSCApps\BudgetModule\app\data\CSTEST2.TXT"



Set session = New WinSCPnet.session
Set transferOptions = New transferOptions

Set sessionOptions = New WinSCPnet.sessionOptions
sessionOptions.Protocol = Protocol_Sftp

sessionOptions.HostName = "colapp1-prod.cloud.rsccd.edu"
sessionOptions.username = "svc_FileProcessing"
sessionOptions.Password = "L2)uUYZ!MSf2"

sessionOptions.SshHostKeyFingerprint = "ssh-rsa 2048 xx:xx.."

' Connect
session.Open sessionOptions

' Upload file
transferOptions.TransferMode = TransferMode_Binary

transferOptions.PreserveTimestamp = False

Set transferResult = session.PutFiles(longFilenameLocal, remoteFilePath, False, transferOptions)

' Throw on any error
transferResult.Check
log.txt (6.45 KB) [Download]

Description: (none)

Guest




sorry I inadvertently posted the password. I'll have to change it.
Guest




Just found the problem: the path to the remote file had a typo!
Found it by looking at the log, it said: "no such file".
Advertisements

You can post new topics in this forum

Search

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!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License