TsgcWebSocketServer_HTTPAPI › Events › OnHTTPUploadAfterSaveFile
Fires after a file extracted from a multipart/form-data upload has been saved to disk.
property OnHTTPUploadAfterSaveFile: TsgcWSHTTPUploadAfterSaveFileEvent;
// TsgcWSHTTPUploadAfterSaveFileEvent = procedure(Sender: TObject; const aFileName, aFilePath: string) of object
—
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 IOCP worker thread after all files in the request have been extracted.
procedure OnHTTPUploadAfterSaveFileEvent(Sender: TObject; const aFileName: string;
const aFilePath: string);
begin
DoLog('File Received: ' + aFileName);
end;