public override void UploadStream(
Stream srcStream,
string remoteFile
)Public Overrides Sub UploadStream (
srcStream As Stream,
remoteFile As String
)public:
virtual void UploadStream(
Stream^ srcStream,
String^ remoteFile
) overrideabstract UploadStream :
srcStream : Stream *
remoteFile : string -> unit
override UploadStream :
srcStream : Stream *
remoteFile : string -> unit The stream is closed after the transfer is complete if CloseStreamsAfterTransfer is true (the default) and are left open otherwise. If the stream is left open the its position will be at the end of the stream. Use Seek(Int64, SeekOrigin) to change the position if required.
// build StringStream (defined below) for "Hello world"
byte[] bytes = Encoding.ASCII.GetBytes("Hello world");
MemoryStream inStr = new MemoryStream(bytes);
// upload the stream to a file on the server
ftpConnection.UploadStream(inStr, "helloworld.txt");
inStr.Close();
// create a MemoryStream and download into it
MemoryStream outStr = new MemoryStream();
ftpConnection.DownloadStream(outStr, "helloworld.txt");
outStr.Seek(0, SeekOrigin.Begin);
string str = Encoding.GetString(outStr.GetBuffer());
Console.WriteLine(str);
outStr.Close();