Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

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

0701

Thank you. I changed the options and the error does not seem to appear anymore.
0701

Uploading often does not work

I often get the following error:
Error code: 2
Error message from server: No such file
at TestAndSmileSQL.Classes.Ftps.WinScpUploadFileAsync(String sFtpAddress, String sRemotePath, String userName, String password, String sFile, String sClient, Protocol protocol) in C:\Prog\TestandSmileSQL_B95q\Classes\Ftps.cs:line 273
2024-05-28 21:49:09.180 +02:00 [INF] Err: WinScpUploadFile FtpAddress: xxx.227.176.xxx RemotePath: /var/www/html/upload/800001419973.pdf Client. 100087 ex: WinSCP.SessionRemoteException: Transfer was successfully finished, but temporary transfer file '800001419973.pdf.filepart' could not be renamed to target file name '800001419973.pdf'. If the problem persists, you may try to turn off transfer resume support.
No such file or directory.

My code is:
SessionOptions sessionOptions = new SessionOptions {
    Protocol = protocol,
    HostName = sFtpAddress,
    UserName = userName,
    Password = password,
    FtpMode = FtpMode.Passive,
    PortNumber = iPort,
};
if (sessionOptions.Protocol == WinSCP.Protocol.Sftp) {
    sessionOptions.SshHostKeyFingerprint = Gets.GetTestAndSmileIniEntry("SshHostFingerprint=", sClient);
}
 
using (Session session = new Session()) {
    session.Open(sessionOptions);
    TransferOptions transferOptions = new();
    transferOptions.TransferMode = TransferMode.Binary;
    TransferOperationResult transferResult;
    transferResult = session.PutFiles(sFile, sRemotePath, false, transferOptions);
    transferResult.Check();
}

It occurs with the line transferResult.Check()

Thanks for any help.