TsgcWSPClient_Files › Events › OnFileReceivedAuthorization
Fires when a qosLevel2 file is about to be saved, letting you accept or reject it and optionally rename the destination.
property OnFileReceivedAuthorization: TsgcWSFileAuthorizationEvent;
// TsgcWSFileAuthorizationEvent = procedure(Connection: TsgcWSConnection; const aMessage: TsgcWSMessageFile; var aFileName: string; var Accept: Boolean) of object
—
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).
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;