# CloudUploadFile

**CloudUploadFile** is part of the **RadCloudUpload** control. It is the entity that tracks all upload-related tasks. This class does not upload a file to the cloud. It encapsulates a provider, a file name and a file stream and handles all upload-related tasks, such as progress-tracking and cancellation. The **CloudUploadFile** object is expected to be the **DataContext** of the [RadCloudUploadListItem](https://www.telerik.com/products/wpf/documentation/controls/radcloudupload/features/radclouduploadlistitem).

> The **CloudUploadFile** class does not open or dispose the stream. The disposal should be handled by the owner of this object.

## Properties

**CloudUploadFile** exposes several key properties. Note that this section does not list all public properties of the class.

* **State**: A property of type **CloudUploadFileState** that gets the current state of the upload operation. The property cannot be set, and it can be used only for tracking the state of the item.

* **UploadResult**: A property of type **Object** that gets the result of the upload operation. The value of the property depends on the result that will be returned by the upload request from the upload provider.

  > You can subscribe to the **StateChanged** event of the **CloudUploadFile** in order to track the upload result and changes in the item's state. You can also use the **ItemStateChanged** event of **RadCloudUpload**.

* **UploadedBytes**: A property of type **long** that gets the count of uploaded bytes.

* **FileName**: A property of type **string** that gets the name of the file.

* **FileSize**: A property of type **long** that gets the size of the file.

* **ValidationErrors**: A property of type **List\<object>** that gets a collection with the upload validation errors, if there are any.

* **Provider**: A property of type **ICloudUploadProvider** that gets and sets the upload provider.

## Events

The **CloudUploadFile** class exposes several events.

* **StateChanged**: The event occurs when the value of the **State** property changes. The event arguments are of type **CloudUploadFileStateChangedEventArgs** and expose the following properties.
  * **Item**: An object of type **CloudUploadFile** that gets the cloud upload file item.
  * **NewState**: An object of type **CloudUploadFileState** that gets the new state of the item.
  * **OldState**: An object of type **CloudUploadFileState** that gets the old state of the item.

* **ProgressChanged**: The event occurs when the upload progress changes. The event arguments are of type **EventArgs**.

* **StartUploadRequested**: The event occurs when starting upload is requested. The event arguments are of type **StartUploadRequestedEventArgs** and expose a single method, **ShouldQueueUpload**, which can be used to indicate whether the item should be queued for upload or started directly.

* **CloseRequested**: The event occurs when a close is requested. A close is requested when the **RequestClose** method is called or the **RequestCloseCommand** is executed. The event arguments are of type **EventArgs**.

* **PropertyChanged**: The event occurs when a property value changes. The event arguments are of type **PropertyChangedEventArgs**.

## See Also

* [RadCloudUploadListItem](https://www.telerik.com/products/wpf/documentation/controls/radcloudupload/features/radclouduploadlistitem)
* [Events](https://www.telerik.com/products/wpf/documentation/controls/radcloudupload/features/events)
* [CloudUploadFile API](https://docs.telerik.com/devtools/wpf/api/telerik.windows.cloud.controls.upload.clouduploadfile)
