RadControls for Silverlight

The RadUpload allows you to apply some limitations regarding the size and the count of the files which the user wants to upload. This topic will explain the following:

Maximum File Size

To limit the size of a single file, you have to set the MaxFileSize property of the RadUpload. The value of the property should be in bytes. Here is an example of RadUpload with MaxFileSize of 1 MB (the default value is long.MaxValue):

CopyXAML
<telerik:RadUpload MaxFileSize="1000000" />
Note

When the maximum file size gets exceeded, the FileTooLarge event gets raised. More about the events can be found here.

If the selected file is larger than 1 MB, it won't be added to the list and the RadUpload will display a notification icon and a tooltip with an error message.

Tip
You can see the size of each file in the list on the right side of its container.

Maximum Total Upload Size

To limit the total size of the files, you have to set the MaxUploadSize property of the RadUpload. The value of the property should be in bytes. Here is an example of RadUpload with MaxUploadSize of 2 MB (the default value is long.MaxValue):

CopyXAML
<telerik:RadUpload MaxUploadSize="2000000" />
Note

When the total upload size gets exceeded the UploadSizeExceeded event gets raised. More about the events can be found here.

If the selected files make the total upload size larger than 2 MB, the files, that are over the limit, won't be added to the list and the RadUpload will display a notification icon and a tooltip with an error message.

Tip
You can see the total size of the files in the list on the right side of the total details container.

Maximum Files Count

To limit the count of the files that can be uploaded at a time, you have to set the MaxFileCount property of the RadUpload control. Here is an example of a RadUpload with MaxFileCount set to 2 (the default value is int.MaxValue).

CopyXAML
<telerik:RadUpload MaxFileCount="2" />
Note

When the maximum file size gets exceeded, the FileCountExceeded event gets raised. More about the events can be found here.

If the count of the files in the list becomes greater than the allowed one, the files that are over the count, won't be added to the list and the RadUpload will display a notification icon and a tooltip with an error message.

See Also