# Open a RadOpenFileDialog when Using the RadCloudUpload

## Environment

<table>
	<tr>
		<td>Product</td>
		<td>RadCloudUpload for WPF</td>
	</tr>
</table>

## Description

How to replace the default MS OpenFileDialog with a [RadOpenFileDialog](https://www.telerik.com/products/wpf/documentation/controls/radfiledialogs/dialog-controls/radopenfiledialog).

## Solution

Handle the **AddingFiles** event of the RadCloudUpload control, cancel the creation of the default dialog with the **CancelDialogOpening** property, open a new RadOpenFileDialog and populate the **FileNames** collection with the files, selected in the dialog.

```C#
    private void RadCloudUpload_AddingFiles(object sender, AddingFilesEventArgs e)
    {
        e.CancelDialogOpening = true;

        if (fileDialog == null)
        {
            fileDialog = new RadOpenFileDialog();
            fileDialog.Multiselect = true;
        }

        if (fileDialog.ShowDialog() == true)
        {
            foreach (var file in fileDialog.FileNames)
            {
                e.FileNames.Add(file);
            }
        }
    }
```

```VB.NET
	Private Sub RadCloudUpload_AddingFiles(ByVal sender As Object, ByVal e As AddingFilesEventArgs)
		e.CancelDialogOpening = True

		If fileDialog Is Nothing Then
			fileDialog = New RadOpenFileDialog()
			fileDialog.Multiselect = True
		End If

		If fileDialog.ShowDialog() = True Then
			For Each file In fileDialog.FileNames
				e.FileNames.Add(file)
			Next file
		End If
	End Sub
```

## See Also

* [RadCloudUpload Events](https://www.telerik.com/products/wpf/documentation/controls/radcloudupload/features/events)
* [RadOpenFileDialog](https://www.telerik.com/products/wpf/documentation/controls/radfiledialogs/dialog-controls/radopenfiledialog)
