Advertisement
Guest User

Untitled

a guest
Apr 21st, 2016
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1. function TModel.Send(LocalFile : string; remoteFile : string; RemoteDir : string) : boolean;
  2. //===========================================================================
  3. // **********************************************************************
  4. // * Send a file to the FTP server *
  5. // **********************************************************************
  6. //---------------------------------------------------------------------------
  7. var
  8. rc : boolean;
  9. begin
  10. // Create the FTP Client object and set the FTP parameters
  11. FTPClient := TFTPSend.Create;
  12. with FTPClient do begin
  13. TargetPort := cFtpProtocol;
  14. TargetHost := fHost; // these were properties set somewhere else
  15. UserName := fUserID;
  16. Password := fPassword;
  17. //-----------------------------------------------------------------------
  18. // bail out if the FTP connect fails
  19. if not LogIn then exit;
  20. //------------------------------------------------------------------------
  21.  
  22. // Set filename to FTP
  23. DirectFileName := LocalFile;
  24. DirectFile := True;
  25. //------------------------------------------------------------------------
  26.  
  27. // change directory if requested
  28. if RemoteDir <> '' then ChangeWorkingDir(RemoteDir);
  29. //------------------------------------------------------------------------
  30.  
  31. // STOR file to FTP server.
  32. rc := StoreFile(RemoteFile,false);
  33. //------------------------------------------------------------------------
  34.  
  35. // close the connection
  36. LogOut;
  37. //------------------------------------------------------------------------
  38. // free the FTP client object
  39. free;
  40. //------------------------------------------------------------------------
  41. end;
  42. Result := rc;
  43. //===========================================================================
  44. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement