Skip to main content

TdxCloudStorageFileProgressCallback Type

The callback procedural type designed to track file upload and download progress.

Declaration

TdxCloudStorageFileProgressCallback = reference to procedure(const APosition: Int64; const ASize: Int64);

Parameters

Name Type Description
APosition Int64

Returns the number of downloaded or uploaded bytes.

ASize Int64

Returns the size of a downloaded or uploaded file, in bytes. The parameter returns -1 if the server cannot return the downloaded file’s size.

Remarks

Implement a TdxCloudStorageFileProgressCallback procedure to track file upload or download progress. The following code example calculates download progress as a percentage you can display in your application UI:

 var
   AProgress: Integer; // File download progress as a percentage
//...
   if(ASize <> -1) then // If the server provides the file size
     AProgress := Round(APosition/ASize * 100);

The AProgressCallback parameter in the cloud storage component’s DownloadFile and UploadFile functions references the TdxCloudStorageFileProgressCallback procedural type.

See Also