http OutputFileAttributes property
Return to Introduction  Previous page  Next page
Applies to
auHTTP component.  

  TauFileAttribute = (atrArchive, atrHidden, atrReadOnly, atrSystem, atrTemporary, atrOffline);  
  TauFileAttributes = set of TauFileAttribute;  
  TauOutputFileAttributes = class  
    property Complete: TauFileAttributes default [atrArchive];  
    property Incomplete: TauFileAttributes default [atrArchive, atrTemporary];  
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.  
tip You can use this property to make difference between complete and incomplete files for other application, or to quickly determinate whether local file has been 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.  

iiwarning atrTemporary and atrOffline options has no effect in Win95/98/ME. These options are only for NT-family systems. You can set it but they will work only in NT/XP etc.  

auHTTP1.URL := '';  
auHTTP1.OutputFileName := 'c:\';  
auHTTP1.OutputFileAttributes.Complete := [atrArchive]; // Normal  
auHTTP1.OutputFileAttributes.Incomplete := [atrArchive, atrHidden]; // "hide" incomplete file  
// 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);  
  // set file attributes to normal  
  Windows.SetFileAttributes(PChar(FileSize), FILE_ATTRIBUTE_NORMAL);  

See also
OutputFileName property;  
Read, ReadRange, Resume and Pause methods;  
OnOutputFileError and OnDone events.