FTP Code Example: Upload from a stream
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 article please contact our support team at support@nsoftware.com.