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.

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)


Topic review


Re: Possible bug in Session.PutFile

What version of WinSCP are you using? Do you have the latest one? Please set Session.DebugLogPath and attach a complete debug log showing the problem. Also a complete exception callstack.

Possible bug in Session.PutFile

I have been using this client for some time. It's an awesome library.
I am doing a simple upload via streaming.
Usually, when I am uploading I use the physical path method as I have the file physically.
Currently, I am downloading the file from one location and uploading it to another location.
Using this method avoids creating unnecessary files locally.

I am getting an error on this line.

I am not familiar with the internals but I looking at code.
I think this check is incorrect.
this._process.StdIn is going to be null in the beginning.

Below is my code for calling this method.

public void UploadFile(Stream stream, string remotePath)
    // Setup session options
    var sessionOptions = new SessionOptions
        Protocol = Protocol.Ftp,
        HostName = FtpHostName,
        UserName = FtpUser,
        Password = FtpPassword
    using Session session = new Session();
    // Connect
    if (session.Opened)
        session.PutFile(stream, remotePath);