Upload a stream of data to the FTP server in the current working directory.
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 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();
FTPConnection Class | EnterpriseDT.Net.Ftp Namespace | FTPConnection.UploadStream Overload List