MBS CURL sftp file overwrite/replace option?

Continuing from this post: https://forum.xojo.com/38868-mbs-curl-failing-with-new-server/0

The sftp process is properly crawling to the destination data directory - as evidenced by debug messages indicating "Creating directory ‘/maindatadir/userdatadir’ "
But then it gets to writing the file, and I get this message: “Creating the dir/file failed: No such file or directory”

The way I am writing the file via CURL is as follows:

b=f.OpenAsBinaryFile(false) uCURL.stream=b uCURL.OptionInFileSize=b.Length uCURL.OptionURL="sftp://mydomainnam/maindatadir/userdatadir/"+f.name

In the documentation I have for MBS CURL, there is a reference to “OptionFTPAppend as Boolean” - but that does not seem to be an active option (not recognized in the IDE). Is there some file overwrite option I should be setting.

FYI: the file does exist on the server - so I am trying to overwrite it.

what is f.name?

f is the file (folderitem)
so f.name captures how I want the file to be named on the server.

and the name contains spaces or other characters?
which may need encoding as part of the URL?

[quote=317745:@Christian Schmitz]and the name contains spaces or other characters?
which may need encoding as part of the URL?[/quote]
In this case, the name is just “mpastor.db1”

I have been successfully sftp with MBS CURL using the same code, prior to changing the server - so at one time not long ago this was working this way, with that file and file name.

could it be a permission issue?
e.g. server does not allow you to overwrite a file?

[quote=317748:@Christian Schmitz]could it be a permission issue?
e.g. server does not allow you to overwrite a file?[/quote]
I thought about that at the same time you did - on the old server, the data directory permissions are 777, and new server they were only 755. So I changed that to 777 and tested - that didn’t fix it.
I will try changing the file permissions as well and see if that works - stay tuned…

No - that didn’t work. And evidence suggests that isn’t the problem since my SFTP client program does OK writing files into these directories.

I have to take a closer look to assure all my directory names are lining up correctly - they look like they are - but I need to double check to be sure.

Let me know if anything else comes to mind from your side.

After getting some help from Christian and Jason we found that I was addressing sftp://mydomain/ which is consistent with how I would specify an http address. But for sftp, this needs to be sftp://mydomain/web/. This is the case for Xojo Cloud hosting; it is hard for me to conclude if similar differences would apply to other hosting services.

Big thanks to Christian and Jason!