Post a reply

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

martin

Re: Reply

For that we need to know the answer:
"Do you or do you not have the permissions to delete the file?"

See also Turning off partial uploading in C#.
Abdullah_Mukhtar

Reply

My question is that why I'm getting this error and how to resolve this issue
martin

Re: Error Exception :Error deleting file 'myFiles'. After resumable file upload

What is your question?
Do you or do you not have the permissions to delete the file?
Are you asking how to disable the resumable transfer? Or are you asking why do you get the error?
Abdullah_Mukhtar

Error Exception :Error deleting file 'myFiles'. After resumable file upload

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);
    }
}