ComponentPro UltimateSftp

      Upload data from a stream

      Language Filter: AllSend comments on this topic to ComponentPro

      The Scp class allows you to upload data from a stream to the remote server easily by using the UploadFile method. See the following example for more details:

      using System.IO;
      using ComponentPro.Net;
      
      ...
      
      // Create a new class instance.
      Scp client = new Scp();
      
      // Connect to the SCP server.
      client.Connect("localhost");
      
      // Authenticate.
      client.Authenticate("test", "test");
      
      // ...
      
      FileStream fi = new FileStream("c:\\test.dat", FileMode.Open);
      
      // Upload data from a stream to '/test.dat'.
      client.UploadFile(fi, "/test.dat");
      
      fi.Close();
      
      // ... 
       
      // Disconnect.
      client.Disconnect();