login about faq

I'm trying to create or truncate a file on the server (original code in FoxPro), but I'm getting the following response. I had changed the disposition to "createTruncate,deleteOnClose" when this started, and I removed deleteOnClose back out, but I am still receiving this message:

SftpVersion: 3
sftpOpenFile:
remotePath: (IP address cleared for security)/FTPTEST.TXT
access: readWrite
createDisposition: createTruncate
v3Flags: 0x1b
Sent FXP_OPEN
StatusResponseFromServer:
Request: FXP_OPEN
InformationReceivedFromServer:
StatusCode: 2
StatusMessage: No such file
Actual code is as follows:
lcTargetFile = lcServerName + lcFoldername + "FTPTEST.TXT"
oSFTP.CONNECT(lcServerName,lnFTPPort)
oSFTP.AuthenticatePW(lcServerUID, lcServerPwd)
oSFTP.InitializeSFTP()
lnHandle = oSFTP.OpenFile(lcTargetFile,"readWrite","createTruncate")
My handle at this point is an empty string, and the LastErrorText returns the above. Any hints or help would be greatly appreciated!

asked Jun 23 at 09:09

BrianFarris's gravatar image

BrianFarris
1


The remote file path argument to OpenFile should be a relative path from the HOME directory of the SSH/SFTP user account. You probably don't want the server name in the path, and you probably don't want the path to begin with "/" (which would specify an absolute path on the remote server).

link

answered Jun 23 at 09:18

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

I get the same response if I just use oSFTP.OpenFile("FTPTEST.TXT","readWrite","createTruncate"), except the remote path line is simply FTPTEST.TXT.

(Jun 23 at 09:25) BrianFarris

When a customer under support provides me with a login for such a problem, the first thing I do is to get my bearings -- immediately after authenticating, I run a snippet of code that fetches the HOME directory listing and shows the entries (files/sub-directories) that are present. If they don't match what I would expect to see, then...

link

answered Jun 23 at 09:32

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×200
×98
×5

Asked: Jun 23 at 09:09

Seen: 284 times

Last updated: Jun 23 at 09:32

powered by OSQA