TsgcWSPServer_FilesEvents › OnFileReceivedFragment

OnFileReceivedFragment Event

Fired when a fragment of a file is received; useful to report progress and allow cancellation.

Syntax

property OnFileReceivedFragment: TsgcWSFileFragmentEvent;
// TsgcWSFileFragmentEvent = procedure(Connection: TsgcWSConnection; const aMessage: TsgcWSMessageFile; var Cancel: Boolean) of object

Default Value

Remarks

Fires for every fragment written to the destination file. Use aMessage.FilePosition and aMessage.FileSize to compute progress. Set Cancel to True to abort the transfer; the partial file is removed and OnFileReceivedError is raised.

Example

procedure TForm1.oFilesFileReceivedFragment(Connection: TsgcWSConnection;
  const aMessage: TsgcWSMessageFile; var Cancel: Boolean);
begin
  ProgressBar1.Position := Round((aMessage.FilePosition / aMessage.FileSize) * 100);
end;

Back to Events