TsgcWSPClient_FilesEvents › OnFileReceivedAuthorization

OnFileReceivedAuthorization Event

Fires when a qosLevel2 file is about to be saved, letting you accept or reject it and optionally rename the destination.

Syntax

property OnFileReceivedAuthorization: TsgcWSFileAuthorizationEvent;
// TsgcWSFileAuthorizationEvent = procedure(Connection: TsgcWSConnection; const aMessage: TsgcWSMessageFile; var aFileName: string; var Accept: Boolean) of object

Default Value

Remarks

Change aFileName to redirect the incoming file to a custom path, or set Accept to False to reject the transfer; the protocol then raises a rejection error that the sender receives through OnFileSentError. Only invoked for qosLevel2 transfers (where authorisation is a required step).

Example

procedure TForm1.oProtocolFileReceivedAuthorization(Connection: TsgcWSConnection;
  const aMessage: TsgcWSMessageFile; var aFileName: string; var Accept: Boolean);
begin
  Accept := aMessage.FileSize < 10 * 1024 * 1024;
  aFileName := 'C:\Downloads\' + aMessage.FileName;
end;

Back to Events