Topic "Error uploading file"

Author Message
mwulfe
[View user's profile]

Joined: 2013-03-07
Posts: 3
Location: Washington, DC area
I am trying to use VBA in Excel 2010 to upload a file to my SFTP server. When I use WinSCP.exe, the file uploads, but only after a message saying "Upload of the file <FileName> was successful, but error occurred while setting the permissions and/or timestamp. If the problem persists, turn on "ignore permission errors" option."

When I try to upload using VBA, I get error number 2146233088, "Cannot create remote file <filename>". I have tried a filepermissions object and setting Otherwrite, Userwrite, and Groupwrite all to True, but it makes no difference:

Code:
   mySession.Open mySessionOptions
    Dim myFilePermissions As New FilePermissions
    myFilePermissions.OtherWrite = True
    myFilePermissions.UserWrite = True
    myFilePermissions.GroupWrite = True
    Dim myTransferOptions As New TransferOptions
    myTransferOptions.TransferMode = TransferMode.TransferMode_Binary
    myTransferOptions.preservetimestamp = False
    myTransferOptions.FilePermissions = myFilePermissions
     
    Dim transferResult As TransferOperationResult
    Set transferResult = mySession.PutFiles("D:\temp\ADBCopy.bat", "/Distribution/FTFZI/PILOT/*.*", False, myTransferOptions)

    ' Throw on any error
    transferResult.Check


As soon as transferResult.Check runs, it throws the error. What am I doing wrong?
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24991
Location: Prague, Czechia
Have you tried setting FilePermissions to Null? (it's actually a default value).
Make sure you also keep preservetimestamp = False

See
https://winscp.net/eng/docs/faq_not_owner
mwulfe
[View user's profile]

Joined: 2013-03-07
Posts: 3
Location: Washington, DC area
Not sure how to do this in VBA. I have tried "= Null" or "= Nothing" and both generated errors. Do you have some sample code for setting that to null?

prikryl wrote:
Have you tried setting FilePermissions to Null? (it's actually a default value).
Make sure you also keep preservetimestamp = False

See
https://winscp.net/eng/docs/faq_not_owner
mwulfe
[View user's profile]

Joined: 2013-03-07
Posts: 3
Location: Washington, DC area
mwulfe wrote:
Not sure how to do this in VBA. I have tried "= Null" or "= Nothing" and both generated errors. Do you have some sample code for setting that to null?

prikryl wrote:
Have you tried setting FilePermissions to Null? (it's actually a default value).
Make sure you also keep preservetimestamp = False

See
https://winscp.net/eng/docs/faq_not_owner


The answer was in the rights I was given by the server. When those were changed, I could copy the files.

Martin, thanks for your help!
Advertisements

You can post new topics in this forum






Search Site

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