![]() |
![]() ![]() ![]() |
auHTTP component.
|
type
|
TauFileAttribute = (atrArchive, atrHidden, atrReadOnly, atrSystem, atrTemporary, atrOffline);
|
TauFileAttributes = set of TauFileAttribute;
|
|
TauOutputFileAttributes = class
|
published
|
property Complete: TauFileAttributes default [atrArchive];
|
property Incomplete: TauFileAttributes default [atrArchive, atrTemporary];
|
end;
|
|
property OutputFileAttributes: TauOutputFileAttributes;
|
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.
|
![]() |
auHTTP1.URL := 'http://www.domain.com/filename.zip';
|
auHTTP1.OutputFileName := 'c:\filename.zip';
|
auHTTP1.OutputFileAttributes.Complete := [atrArchive]; // Normal
|
auHTTP1.OutputFileAttributes.Incomplete := [atrArchive, atrHidden]; // "hide" incomplete file
|
auHTTP1.Read;
|
|
// and when file will be successfully downloaded you can
|
// change the file attributes to Normal in the OnDone event handler
|
procedure TForm1.auHTTP1Done(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.
|