FTP Code Example: Upload from a stream

Shows how to use the component to upload from a stream.

Date Entered: 03/26/2008    Last Updated: 03/27/2008

As of IPWorks V8 you can upload from a stream to a remote file on the FTP server. The stream should be open and normally set to position 0. The component will automatically close this stream if the CloseStreamAfterTransfer configuration setting is true (default).
C#
ftp.RemoteFile = "test.txt";
ftp.SetUploadStream(new FileStream("c:\\test.txt", FileMode.Open));
ftp.Upload();

VB .NET
ftp.RemoteFile = "test.txt"
ftp.SetUploadStream(New FileStream("c:\test.txt", FileMode.Open))
ftp.Upload()

Java
ftp.setRemoteFile("test.txt");
ftp.setUploadStream(new java.io.FileInputStream("c:\\test.txt"));
ftp.upload();

We appreciate your feedback.  If you have any questions, comments, or suggestions about this entry please contact our support team at kb@nsoftware.com.