HttpReceiveToStream
function HttpReceiveToStream(const aExchange: iHttpServerExchange; aStream: TStream; aBufferBytes: Integer; aIdleMSec: Cardinal; out aBytes: Int64): tHttpServerReadResult;
Writes a streaming request's body to aStream as it arrives - a TFileStream, for an upload that is to be a file - so that no more of it is in memory than the route's BufferBytes and this call's own buffer of aBufferBytes (at least 1; 65536 is a good value). Call it on your worker thread, where you would otherwise loop over Read and WaitForBody; it is that loop. hsrrComplete the whole body is in aStream and passed the wire's checks: Trailers is final and TryComplete can succeed.
hsrrFailed the request failed, was cancelled or was rejected; see Failed and FailText. What was written is not a body.
hsrrPending nothing arrived for aIdleMSec. Call again to go on waiting, or Cancel. aBytes is what THIS call wrote, in every case. As with Read, nothing written is final before hsrrComplete: write to a temporary file and move it into place then. An exception from aStream - a full disk - passes to you with the exchange untouched: answer with TryReject, or Cancel.