Session.PutFile Method
Uploads data from System.IO.Stream to a remote file.
For an efficient upload from a physical local file, use Session.PutFileToDirectory and similar methods instead.
Syntax
C#
      public void PutFile( System.IO.Stream stream, string remoteFilePath, TransferOptions options = null )
VB.NET
      Public Sub PutFile( stream As System.IO.Stream, remoteFilePath As String, Optional options As TransferOptions = Nothing )
Parameters
| Name | Description | 
|---|---|
| System.IO.Stream stream | The Streamto upload the data from. The implementation needs to support only theReadmethod. The stream is read until theReadmethod returns zero or throws an exception. The method does not close nor dispose the stream. | 
| string remoteFilePath | Full path to a remote file to upload the data to. | 
| TransferOptions options | Transfer options. Defaults to null, what is equivalent tonew TransferOptions(). | 
Remarks
Event Session.FileTransferred is raised for the upload. Also raises Session.FileTransferProgress throughout the transfer, but because size of the source data is unknown, the FileProgress and OverallProgress fields of FileTransferProgressEventArgs are not valid.1
Streaming is supported with the SFTP and FTP protocols only.
Contrary to some other upload methods, like Session.PutFiles, this method throws an exception on error automatically.
- The caller of the method can calculate the progress though, by monitoring reads from the stream.Back