TsgcWSPServer_Files › Events › OnFileReceivedFragment
Fired when a fragment of a file is received; useful to report progress and allow cancellation.
property OnFileReceivedFragment: TsgcWSFileFragmentEvent;
// TsgcWSFileFragmentEvent = procedure(Connection: TsgcWSConnection; const aMessage: TsgcWSMessageFile; var Cancel: Boolean) of object
—
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.
procedure TForm1.oFilesFileReceivedFragment(Connection: TsgcWSConnection;
const aMessage: TsgcWSMessageFile; var Cancel: Boolean);
begin
ProgressBar1.Position := Round((aMessage.FilePosition / aMessage.FileSize) * 100);
end;