TsgcWebSocketServer_HTTPAPIProperties › HTTPUploadFiles

HTTPUploadFiles Property

Controls how files uploaded through HTTP POST are buffered (memory or file stream) and saved to disk.

Syntax

public TsgcHTTPUploadFilesServer HTTPUploadFiles { get; set; }

Default Value

StreamType=pstMemoryStream, MinSize=0, RemoveBoundaries=True

Remarks

By default, files uploaded through an HTTP POST are buffered in memory, which is convenient for small payloads but problematic for large files. Set StreamType to pstFileStream to stream the upload directly to disk instead. MinSize is the minimum size in bytes before a payload is redirected to a file stream (0 means every upload is written to disk when pstFileStream is active). SaveDirectory is the destination folder (defaults to the application directory when empty). RemoveBoundaries (default True) strips the multipart/form-data boundaries before saving.

Example


oServer = new TsgcWebSocketServer_HTTPAPI();
oServer.HTTPUploadFiles.StreamType = TwsPostStreamType.pstFileStream;
oServer.HTTPUploadFiles.SaveDirectory = "c:\\uploads\\";
oServer.HTTPUploadFiles.MinSize = 0;
oServer.HTTPUploadFiles.RemoveBoundaries = true;
oServer.Active = true;

Back to Properties