![]() |
![]() ![]() ![]() |
acHTTP component.
|
type
|
TacFileAttribute = (atrArchive, atrHidden, atrReadOnly, atrSystem, atrTemporary, atrOffline);
|
TacFileAttributes = set of TacFileAttribute;
|
|
TacOutputFileAttributes = class
|
published
|
property Complete: TacFileAttributes default [atrArchive];
|
property Incomplete: TacFileAttributes default [atrArchive, atrTemporary];
|
end;
|
|
property OutputFileAttributes: TacOutputFileAttributes;
|
The OutputFileAttributes property allows to specify the file attributes for file which being downloaded to location specified in OutputFileName property.
|
|
There is 2 "sub-properties": Complete and Incomplete.
|
|
Incomplete property specifies flags for incomplete file which still being downloaded (or paused, but still not downloaded to local drive completely).
|
|
Complete specifies attributes which being set to the OutputFileName once the download finished and file completely downloaded.
|
|
![]() |
|
Also, anyway you will be able to rename the downloaded file and change its file attributes (using SetFileAttributes WinAPI), in the OnDone event handler.
|
![]() |
acHTTP1.URL := 'http://www.domain.com/filename.zip';
|
acHTTP1.OutputFileName := 'c:\filename.zip';
|
acHTTP1.OutputFileAttributes.Complete := [atrArchive]; // Normal
|
acHTTP1.OutputFileAttributes.Incomplete := [atrArchive, atrHidden]; // "hide" incomplete file
|
acHTTP1.Read;
|
|
// and when file will be successfully downloaded you can
|
// change the file attributes to Normal in the OnDone event handler
|
procedure TForm1.acHTTP1Done(Sender: TObject; const ContentType: string;
|
FileSize: Integer; Stream: TStream);
|
begin
|
// set file attributes to normal
|
Windows.SetFileAttributes(PChar(FileSize), FILE_ATTRIBUTE_NORMAL);
|
end;
|
OutputFileName property;
|
Read, ReadRange, Resume and Pause methods;
|
OnOutputFileError and OnDone events.
|