TsgcWebSocketHTTPServerEvents › OnHTTPUploadAfterSaveFile

OnHTTPUploadAfterSaveFile Event

Fires after a file extracted from a multipart/form-data upload has been saved to disk.

Syntax

property OnHTTPUploadAfterSaveFile: TsgcWSHTTPUploadAfterSaveFileEvent;
// TsgcWSHTTPUploadAfterSaveFileEvent = procedure(Sender: TObject; const aFileName, aFilePath: string) of object

Default Value

Remarks

OnHTTPUploadAfterSaveFile is raised once a file from a multipart/form-data body has been written to disk (requires HTTPUploadFiles.StreamType = pstFileStream and HTTPUploadFiles.RemoveBoundaries = True). aFileName contains the final file name and aFilePath the directory where it was stored; combine them to process the file (scan for viruses, queue a background task, update a database...). The event runs in the context of the connection thread after all files in the request have been extracted.

Example


procedure OnHTTPUploadAfterSaveFileEvent(Sender: TObject; const aFileName: string;
  const aFilePath: string);
begin
  DoLog('File Received: ' + aFileName);
end;

Back to Events