The OutputFileName property specifies the target filename for downloaded resource. If the OutputFileName specified, the WinHTTP uses the TFileStream instead of TMemoryStream as the storage for downloaded data.

Use the OutputFileName to specify the target filename if you need save data to the file AND if you don't want to use memory-stream of OnDone event.

If you would like to hide the temporary (incomplete) file while it downloading  set OutputFileAttributes.Incomplete property to [atrHidden].

In case if the OutputFileName can not be created (e.g. path not exists, or file locked by system etc)  OnOutputFileError event occur.

Note

The downloaded document will not be stored to the "OutputFileName", in case if component received erroneous status response code (not 200 - OK and not 206 - Partial Content (if request was initiated by Resume or ReadRange methods)).

In case of HTTP error, the downloaded content will be represented as TMemoryStream in various events of WinHTTP.