Advertisement
Guest User

Untitled

a guest
Mar 20th, 2017
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1. Procedure TfrmFTPManager.FormCreate(Sender: TObject);
  2. Var
  3. FTP_Host, FTP_User, FTP_Password: String;
  4. ConnectFile: TIniFile;
  5. ConnectINIFileName: String;
  6. Begin
  7. ConnectINIFileName := ExtractFilePath(Application.ExeName) + 'connect.ini';
  8.  
  9. If FileExists(ConnectINIFileName) Then
  10. Begin
  11. ConnectFile := TIniFile.Create(ConnectINIFileName);
  12.  
  13. FTP_Host := ConnectFile.ReadString('FTPConfig', 'host', '');
  14. FTP_User := ConnectFile.ReadString('FTPConfig', 'user', '');
  15. FTP_Password := ConnectFile.ReadString('FTPConfig', 'password', '');
  16.  
  17. If FTP_Host.Length < 1 Then
  18. Begin
  19. GenError('FTP Host cannot be empty. '#10#13'Application will now terminate.');
  20. Application.Terminate;
  21. Exit;
  22. End;
  23.  
  24. If FTP_User.Length < 1 Then
  25. Begin
  26. GenError('FTP User cannot be empty. '#10#13'Application will now terminate.');
  27. Application.Terminate;
  28. Exit;
  29. End;
  30.  
  31. If FTP_Password.Length < 1 Then
  32. Begin
  33. GenError('FTP Password cannot be empty. '#10#13'Application will now terminate.');
  34. Application.Terminate;
  35. Exit;
  36. End;
  37.  
  38. ConnectFile.Free;
  39.  
  40. With Ftp Do
  41. Begin
  42. Host := FTP_Host;
  43. Username := FTP_User;
  44. Password := FTP_Password;
  45. End;
  46.  
  47. IdOpenSSLSetLibPath
  48. ('C:UsersJacquesDocumentsEmbarcaderoStudioProjectsFTP ManagerWin32Debug');
  49.  
  50. End
  51. Else
  52. Begin
  53. GenError('Unable to find ' + ConnectINIFileName +
  54. ' file in application root directory. '#10#13'Application will now terminate.');
  55. Application.Terminate;
  56. End;
  57. End;
  58.  
  59. Procedure TfrmFTPManager.Button1Click(Sender: TObject);
  60. Begin
  61. Ftp.Connect;
  62. WhichFailedToLoad();
  63.  
  64. // Ftp.ChangeDir ('/');
  65. // Ftp.Put ('C:ftp-test.txt', 'DEV/From_InternationalDebtControl/ftp-test1.txt');
  66. // Ftp.Disconnect;
  67. End;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement