While uploading file using WinSCP .NET library following error occurred:
Error Exception :Error deleting file 'myFiles'. After resumable file upload the existing destination file must be deleted. If you do not have permissions to delete file destination file, you need to disable resumable file transfers.
General failure (server should provide error description).
Error code: 4
Error message from server: Failure
Bellow is my code
using (Session session = new Session())
{
session.Open(sessionOptions);
Console.WriteLine("Connection Successful...");
RemoteDirectoryInfo directoryInfo = session.ListDirectory("/");
// Upload files
TransferOptions transferOptions = new TransferOptions();
transferOptions.TransferMode = TransferMode.Binary;
TransferOperationResult transferResult;
if (File.Exists(stFileName))
{
transferResult = session.PutFiles(stFileName, RemoteFolderPath, false, transferOptions);
// Throw on any error
transferResult.Check();
// Print results
foreach (TransferEventArgs transfer in transferResult.Transfers)
{
Console.WriteLine("Upload of {0} succeeded", transfer.FileName);
}
}
else
{
Console.WriteLine("File not found : " + stFileName);
}
}