Uploading often does not work
I often get the following error:
It occurs with the line
Thanks for any help.
My code is: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.
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(); }
transferResult.Check()
Thanks for any help.