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

mwulfe

Re: Error uploading file

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?

martin 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!
mwulfe

Re: Error uploading file

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?

martin 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
martin

Re: Error uploading file

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

Error uploading file

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:

   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?