/// <summary> /// FtpInternalSendFile() --> Performs an FTP Upload. /// </summary> /// <param name="cust">Indicates the name of supplier portal customer.</param> /// <param name="app">Indicates the name of eFlow application.</param> /// <param name="fn">Indicates the name of the file to upload.</param> /// <param name="fnUp">Indicates the name of the file on the server (how it will be called once uploaded).</param> /// <param name="folder">Indicates the folder where the file will be uploaded</param> /// <param name="hostname">Indicates the host name where the file will be uploaded</param> /// <param name="username">Indicates the name of the user allowed to login into the hostname</param> /// <param name="pwd">Indicates the password of the user allowed to login into the hostname</param> /// <example><code>s.FtpInternalSendFile("topimagesystems.com", "CLS", "00000323.tif", "/images", "ftp.doksend.com", "supplierportaluser", "e7low5!!");</code></example> protected bool FtpInternalSendFile(string cust, string app, string fn, string fnUp, string folder, string hostname, string username, string pwd) { bool result = false; try { using (Chilkat.Ftp2 ftp = new Chilkat.Ftp2()) { if (ftp.UnlockComponent(Constants.cStrChilkatFtpLic)) { ftp.Hostname = hostname; ftp.Username = username; ftp.Password = pwd; ftp.Passive = true; if (ftp.Connect()) { if (ftp.ChangeRemoteDir(folder)) { if (ftp.GetSizeByName(fnUp) < 0) { if (File.Exists(fn)) { result = ftp.PutFile(fn, fnUp); Thread.Sleep(50); } } } } else { Logging.WriteLog(ftp.LastErrorText); } ftp.Disconnect(); } } } catch (Exception ex) { Logging.WriteLog(ex.ToString()); } return(result); }