ComponentPro UltimateFtp

      Upload data from a file on another file system

      Language Filter: AllSend comments on this topic to ComponentPro

      To upload a file from another file system to an FTP server, simply use the CopyTo methods.

      The following example demonstrates how to connect to FTP and SFTP servers, and use the CopyTo method to directly copy a file from the FTP file system to the SFTP file system.

      If you need to upload files and directories within a ZIP file to the FTP server, see the topic Uploading files and directories within a ZIP file to an FTP server.
      using ComponentPro.Net;
      // Connect to an FTP file system.
      Ftp ftpsys = new Ftp();
      ftpsys.Connect("", 21);
      ftpsys.Authenticate("test", "test");
      // Connect to an SFTP file system.
      Sftp sftp = new Sftp();
      sftp.Connect("", 2222);
      sftp.Authenticate("test", "test");
      // Copy 'blog.txt' file from the SFTP file system to the FTP file system.
      sftp.CopyTo("blog.txt", ftpsys, "my blog on FTP file system.txt");