Skip to main content

TdxCloudStorage.UploadFile(string,string,TdxCloudStorageFileProgressCallback,Boolean) Method

Uploads a locally stored file to the cloud storage.

Declaration

function UploadFile(const ATargetPath: string; const AFileName: string; AProgressCallback: TdxCloudStorageFileProgressCallback = nil; AOverwriteIfExists: Boolean = True): TdxCloudStorageFile; overload;

Parameters

Name Type Description
ATargetPath string

The absolute path to the target folder in the cloud storage.

AFileName string

The path to a file on the local machine.

AProgressCallback TdxCloudStorageFileProgressCallback

A callback procedure that tracks file upload progress.

AOverwriteIfExists Boolean

If True, the function overwrites the matching file in the cloud storage; otherwise, the function just returns the metadata container of an existing file.

Returns

Type Description
TdxCloudStorageFile

A cloud file metadata container that corresponds to the uploaded file.

Remarks

The following code example uploads the Image.jpg file in the application’s Images folder to the corresponding folder in a connected cloud storage.

  dxCloudStorage1.UploadFile('/Images/Image.jpg', 'Images/Image.jpg');

You can also implement a callback procedure and pass it as the AProgressCallback optional parameter to track file upload progress. Refer to the TdxCloudStorageFileProgressCallback procedural type description for details. The UploadFile procedure overwrites a file with the matching name in a destination folder. You can pass False as the AOverwriteIfExists optional parameter to preserve a file with the matching name and return the metadata container corresponding to the preserved file.

Note

The UploadFile function always runs in the same thread from which it is called.

See Also