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

Declaration
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;  

Description
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.  

Note
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.  

Example
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;  

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