After upgrading from WinSCP version 5.17.10 to 6.3.6 (.Net) the
PutFiles
method is now uploading files to the folder above the home folder.
This is the code (which hasn't changed)
var sessionOptions = new SessionOptions
{
Protocol = Protocol.Ftp,
HostName = url,
UserName = username,
Password = password,
PortNumber = 21
};
if (!string.IsNullOrEmpty(proxyPort))
{
sessionOptions.AddRawSettings("ProxyHost", proxy);
sessionOptions.AddRawSettings("ProxyPort", proxyPort);
}
using (var session = new Session())
{
session.Open(sessionOptions);
var transferOptions = new TransferOptions();
transferOptions.TransferMode = TransferMode.Ascii;
var transferResult = session.PutFiles(filePath, "/", options: transferOptions);
transferResult.Check();
}
Looking at the logs, the newer version calls
CDUP
just before uploading the file. I have no idea why. Logs for each version are attached (with usernames, server names etc. replaced)
Is there a way I can get it working using the later version?