autoupgrader OnFileStart event
Return to Introduction  Previous page  Next page
Applies to
auAutoUpgrader component.  

  TauAUFileStartEvent = procedure(Sender: TObject;  
     const FileURL: String; FileSize: Integer; FileTime: TDateTime;  
     var CanUpgrade: Boolean) of object;  
property OnFileStart: TauAUFileStartEvent;  

The OnFileStart event occurs after receiving the headers of the file which is about to be downloaded.  
Write the OnFileStart event handler to get the name and size of file which about to be downloaded, plus the date/time of its last modification (time when it has been uploaded to your website). Also, you can use this event to decide, whether you really want to download this file. If your program think that this file should already updated — set CanUpgrade parameter to False and AutoUpgrader will not download it from your website, and will pass to next file in the download queue.  
tip Alternatively, if you don't want to download files only in case if their sizes are different, you can set MiscFilesUpgrade property to mfuOnlyIfSizeDifferent, and the AutoUpgrader will automatically compare the size of remote and local files to decide whether they should be upgraded or not.  

See also
MiscFilesUpgrade property;  
OnFileDone, OnBeginUpgrade, OnEndUpgrade and OnProgress events;  
OnHeaderInfo event of auHTTP component.