private void SaveToFTP(Stream sourceFile, string fullPath)
 {
     FtpClient client = new FtpClient(FtpServer, FtpUserName, FtpPassword, FtpTimeout, FtpPort);
     if (!string.IsNullOrEmpty(TransferMode) && TransferMode.ToLower() == "port")
     {
         client.TransferMode = DataTransferMode.Port;
     }
     else
     {
         client.TransferMode = DataTransferMode.Pasv;
     }
     client.MakeRecursionDir(Path.GetDirectoryName(fullPath));
     client.Upload(sourceFile, Path.GetFileName(fullPath), true);
     client.Close();
 }
 private FileStream DownFromFtp(string categoryPath)
 {
     FtpClient client = new FtpClient(FtpServer, FtpUserName, FtpPassword, FtpTimeout, FtpPort);
     string path = Path.Combine(
         System.Web.HttpContext.Current.Server.MapPath(DownLoadTempDir),
         categoryPath);
     client.Download(path, true);
     return new FileStream(path, FileMode.Open);
 }