>I want to use httpsend to download a file from some website.but the file is
>too big.(>1000M),when i use the procedure:
> function HttpGetBinary(const URL: string; const Response: TStream):
> Boolean;
>
> I find that the procedure will download the file into Stream.and make the
> memory increase.(my computer's memory is 512M).anyone can worked out a
> method to solve it. and can callback the
> download progress.
> thanks.
Try change (in file httpsend.pas)
FDocument: TMemoryStream;
TMemoryStream to TTempFileStream for example.
============================================
type
TTempFileStream = class( TFileStream )
private
FTmpFileName :String;
public
constructor Create;
destructor Destroy; override;
end;{TTempFileStream}
constructor TTempFileStream.Create;
var
N, P :String;
begin
SetLength( P, MAX_PATH );
SetLength( P, GetTempPath( MAX_PATH, PChar( P ) ) );
SetLength( N, MAX_PATH );
if ( GetTempFileName( PChar( P ), 'tfs', 0, PChar( N ) ) = 0 )
then raise Exception.Create('Error open temp file:'+N);
SetLength( N, lstrlen( PChar( N ) ) );
inherited Create(
CreateFile(PChar(N), GENERIC_READ or GENERIC_WRITE,
0, nil, CREATE_ALWAYS, FILE_ATTRIBUTE_TEMPORARY or
FILE_FLAG_SEQUENTIAL_SCAN, 0)
);
FTmpFileName := N;
end;
destructor TTempFileStream.Destroy;
begin
inherited destroy;
DeleteFile( FTmpFileName );
end;
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
synalist-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synalist-public