Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function TModel.Send(LocalFile : string; remoteFile : string; RemoteDir : string) : boolean;
- //===========================================================================
- // **********************************************************************
- // * Send a file to the FTP server *
- // **********************************************************************
- //---------------------------------------------------------------------------
- var
- rc : boolean;
- begin
- // Create the FTP Client object and set the FTP parameters
- FTPClient := TFTPSend.Create;
- with FTPClient do begin
- TargetPort := cFtpProtocol;
- TargetHost := fHost; // these were properties set somewhere else
- UserName := fUserID;
- Password := fPassword;
- //-----------------------------------------------------------------------
- // bail out if the FTP connect fails
- if not LogIn then exit;
- //------------------------------------------------------------------------
- // Set filename to FTP
- DirectFileName := LocalFile;
- DirectFile := True;
- //------------------------------------------------------------------------
- // change directory if requested
- if RemoteDir <> '' then ChangeWorkingDir(RemoteDir);
- //------------------------------------------------------------------------
- // STOR file to FTP server.
- rc := StoreFile(RemoteFile,false);
- //------------------------------------------------------------------------
- // close the connection
- LogOut;
- //------------------------------------------------------------------------
- // free the FTP client object
- free;
- //------------------------------------------------------------------------
- end;
- Result := rc;
- //===========================================================================
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement