Using Session.PutFile() with stream, returns error Operation not supported

Advertisement

nikolasd
Joined:
Posts:
2
Location:
Greece

Using Session.PutFile() with stream, returns error Operation not supported

I am using the latest RC release of WinSCP NuGet package and I am trying to implement PutFile
using (var session = new Session()) {
    if (!session.Opened)
        session.Open(sessionOptions);
 
    var transferOptions = new TransferOptions {
        TransferMode = TransferMode.Binary,
        OverwriteMode = OverwriteMode.Overwrite,   
    };
 
    using (var stream = new MemoryStream(imgData)) {
        session.PutFile(stream, remoteFilePath, transferOptions);
    }
}
session.PutFile throws exception with error message
Operation not supported.
What can be the issue that is causing this error?

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
36,283
Location:
Prague, Czechia

Re: Using Session.PutFile() with stream, returns error Operation not supported

What protocol are you using? The streaming is supported with the SFTP protocol only. With other protocols, you need to save the data to (temporary) file before uploading.

Reply with quote

Advertisement

You can post new topics in this forum