Class RadUpload
A composite control, allowing you to upload a single or multiple files. The RadUpload control allows you to validate in terms of size and extension the selected files on the client, progress display, skin, etc.
Inheritance
Namespace: Telerik.Windows.Controls
Assembly: Telerik.Windows.Controls.Input.dll
Syntax
[TelerikToolboxCategory("Input")]
public class RadUpload : ListBox
Remarks
Use the RadUpload control to allow the upload of a single or multiple files.
Constructors
RadUpload()
Fields
AdditionalPostFieldsProperty
Identifies the AdditionalPostFields property.
Declaration
public static readonly DependencyProperty AdditionalPostFieldsProperty
Field Value
System.Windows.DependencyProperty
|
BufferSizeProperty
Identifies the BufferSize property.
Declaration
public static readonly DependencyProperty BufferSizeProperty
Field Value
System.Windows.DependencyProperty
|
CancelCommandProperty
Identifies the CancelCommand dependency property.
Declaration
public static readonly DependencyProperty CancelCommandProperty
Field Value
System.Windows.DependencyProperty
|
CaptionTextProperty
Identifies the CaptionText dependency property.
Declaration
public static readonly DependencyProperty CaptionTextProperty
Field Value
System.Windows.DependencyProperty
|
DuplicateFileNameFoundEvent
ErrorIconVisibilityProperty
Identifies the ErrorIconVisibility dependency property.
Declaration
public static readonly DependencyProperty ErrorIconVisibilityProperty
Field Value
System.Windows.DependencyProperty
|
ErrorMessageProperty
Identifies the ErrorMessage dependency property.
Declaration
public static readonly DependencyProperty ErrorMessageProperty
Field Value
System.Windows.DependencyProperty
|
FileCountExceededEvent
Occurs when a user has selected more that the allowed files count. See MaxFileCount property.
Declaration
public static readonly RoutedEvent FileCountExceededEvent
Field Value
RoutedEvent
|
FilesSelectedEvent
Occurs when the files are selected from the user.
Declaration
public static readonly RoutedEvent FilesSelectedEvent
Field Value
RoutedEvent
|
FileTooLargeEvent
Occurs when a file that is selected is too large. See MaxFileSize property.
Declaration
public static readonly RoutedEvent FileTooLargeEvent
Field Value
RoutedEvent
|
Remarks
You can handle the FileSelected event and check the CurrentSession's TooLargeFiles collection instead.
FileUploadedEvent
Occurs when the file is uploaded.
Declaration
public static readonly RoutedEvent FileUploadedEvent
Field Value
RoutedEvent
|
FileUploadFailedEvent
Occurs when the file failed to upload.
Declaration
public static readonly RoutedEvent FileUploadFailedEvent
Field Value
RoutedEvent
|
FilterIndexProperty
Identifies the FilterIndex property.
Declaration
public static readonly DependencyProperty FilterIndexProperty
Field Value
System.Windows.DependencyProperty
|
FilterProperty
Identifies the Filter property.
Declaration
public static readonly DependencyProperty FilterProperty
Field Value
System.Windows.DependencyProperty
|
IsAppendFilesEnabledProperty
Identifies the IsAppendFilesEnabled property.
Declaration
public static readonly DependencyProperty IsAppendFilesEnabledProperty
Field Value
System.Windows.DependencyProperty
|
IsAutomaticUploadProperty
Identifies the IsAutomaticUpload property.
Declaration
public static readonly DependencyProperty IsAutomaticUploadProperty
Field Value
System.Windows.DependencyProperty
|
IsDeleteEnabledProperty
Identifies the IsDeleteEnabled property.
Declaration
public static readonly DependencyProperty IsDeleteEnabledProperty
Field Value
System.Windows.DependencyProperty
|
IsDropFilterEnabledProperty
Identifies the IsDropFilterEnabled property.
Declaration
public static readonly DependencyProperty IsDropFilterEnabledProperty
Field Value
System.Windows.DependencyProperty
|
IsMultiselectProperty
Identifies the IsMultiSelect property.
Declaration
public static readonly DependencyProperty IsMultiselectProperty
Field Value
System.Windows.DependencyProperty
|
IsPauseEnabledProperty
Identifies the IsPauseEnabled property.
Declaration
public static readonly DependencyProperty IsPauseEnabledProperty
Field Value
System.Windows.DependencyProperty
|
MaxFileCountProperty
Identifies the MaxFileCount property.
Declaration
public static readonly DependencyProperty MaxFileCountProperty
Field Value
System.Windows.DependencyProperty
|
MaxFileSizeProperty
Identifies the MaxFileSize property.
Declaration
public static readonly DependencyProperty MaxFileSizeProperty
Field Value
System.Windows.DependencyProperty
|
MaxUploadSizeProperty
Identifies the MaxUploadSize property.
Declaration
public static readonly DependencyProperty MaxUploadSizeProperty
Field Value
System.Windows.DependencyProperty
|
OverwriteExistingFilesProperty
Identifies the OverwriteExistingFiles property.
Declaration
public static readonly DependencyProperty OverwriteExistingFilesProperty
Field Value
System.Windows.DependencyProperty
|
PauseCommandProperty
Identifies the PauseCommand dependency property.
Declaration
public static readonly DependencyProperty PauseCommandProperty
Field Value
System.Windows.DependencyProperty
|
ProgressChangedEvent
Occurs when the progress of the upload session is changed.
Declaration
public static readonly RoutedEvent ProgressChangedEvent
Field Value
RoutedEvent
|
ProgressValueProperty
Identifies the ProgressValue dependency property.
Declaration
public static readonly DependencyProperty ProgressValueProperty
Field Value
System.Windows.DependencyProperty
|
SelectionVisibilityProperty
Identifies the SelectionVisibility property.
Declaration
public static readonly DependencyProperty SelectionVisibilityProperty
Field Value
System.Windows.DependencyProperty
|
SingleFilePerPostRequestProperty
Identifies the SingleFilePerPostRequest property.
Declaration
public static readonly DependencyProperty SingleFilePerPostRequestProperty
Field Value
System.Windows.DependencyProperty
|
TargetFolderProperty
Identifies the TargetFolder property.
Declaration
public static readonly DependencyProperty TargetFolderProperty
Field Value
System.Windows.DependencyProperty
|
TargetPhysicalFolderProperty
Identifies the TargetPhysicalFolder property.
Declaration
public static readonly DependencyProperty TargetPhysicalFolderProperty
Field Value
System.Windows.DependencyProperty
|
TotalPercentProperty
Identifies the TotalPercent dependency property.
Declaration
public static readonly DependencyProperty TotalPercentProperty
Field Value
System.Windows.DependencyProperty
|
TotalSizeProperty
Identifies the TotalSize dependency property.
Declaration
public static readonly DependencyProperty TotalSizeProperty
Field Value
System.Windows.DependencyProperty
|
UploadCanceledEvent
Occurs when upload session is canceled.
Declaration
public static readonly RoutedEvent UploadCanceledEvent
Field Value
RoutedEvent
|
UploadCommandProperty
Identifies the UploadCommand dependency property.
Declaration
public static readonly DependencyProperty UploadCommandProperty
Field Value
System.Windows.DependencyProperty
|
UploadFinishedEvent
Occurs when upload session is finished.
Declaration
public static readonly RoutedEvent UploadFinishedEvent
Field Value
RoutedEvent
|
UploadPausedEvent
Occurs when upload session is paused.
Declaration
public static readonly RoutedEvent UploadPausedEvent
Field Value
RoutedEvent
|
UploadResumedEvent
Occurs when upload session is resumed.
Declaration
public static readonly RoutedEvent UploadResumedEvent
Field Value
RoutedEvent
|
UploadServiceUrlProperty
Identifies the UploadServiceUrl property.
Declaration
public static readonly DependencyProperty UploadServiceUrlProperty
Field Value
System.Windows.DependencyProperty
|
UploadSizeExceededEvent
Occurs when the size of the selected files is too large. See MaxUploadSize property.
Declaration
public static readonly RoutedEvent UploadSizeExceededEvent
Field Value
RoutedEvent
|
UploadStartedEvent
Occurs when the upload has started.
Declaration
public static readonly RoutedEvent UploadStartedEvent
Field Value
RoutedEvent
|
Properties
AdditionalPostFields
Gets or sets key/value pairs of the fields that will be passed to the UploadHandler on each post request for file upload.
Declaration
public Dictionary<string, string> AdditionalPostFields { get; set; }
Property Value
System.Collections.Generic.Dictionary<System.String, System.String>
|
Remarks
The key value pairs are passed to the handler the way they are named in the Dictionary. In order to get the value in the handler use this.Request.Form["myKey1"] syntax.
Examples
Code sample:
Dictionary<string, string> myPostFields = new Dictionary<string, string>();
myPostFields.Add("myKey1", "myValue1");
myPostFields.Add("myKey2", "myValue2");
RadUpload1.AdditionalPostFields = myPostFields;
.
BufferSize
Gets or sets the size of the chunks on which the files will be posted to the server.
Declaration
public int BufferSize { get; set; }
Property Value
System.Int32
|
Remarks
The size is in Bytes. The default maximum size of the HTTP POST Request is 2MB. If you want to use a buffer size larger than this, you would have to configure this from the server's WebConfig. Setting a 10MB POST Request limit : <httpRuntime maxRequestLength="11000000" executionTimeout="3600"/>.
CancelCommand
Gets or sets a value indicating the cancel command.
Declaration
public DelegateCommand CancelCommand { get; set; }
Property Value
DelegateCommand
|
CaptionText
Gets or sets a value indicating the caption text.
Declaration
public string CaptionText { get; set; }
Property Value
System.String
|
CurrentSession
Holds the data for the current upload session.
Declaration
public RadUploadSession CurrentSession { get; }
Property Value
RadUploadSession
|
ErrorIconVisibility
Gets or sets a value indicating visibility of the error icon.
Declaration
public Visibility ErrorIconVisibility { get; set; }
Property Value
System.Windows.Visibility
|
ErrorMessage
Gets or sets a value indicating error message.
Declaration
public string ErrorMessage { get; set; }
Property Value
System.String
|
Filter
Gets or sets the current file name filter string, which determines the choices that appear in the "Open File Dialog" box.
Declaration
public string Filter { get; set; }
Property Value
System.String
|
Remarks
For each filtering option, the filter string contains a description of the filter, followed by the vertical bar (|) and the filter pattern. The strings for different filtering options are separated by the vertical bar. You can add several filter patterns to a filter by separating the file types with semicolons, for example: Use the FilterIndex property to set which filtering option is shown first to the user. By default all file extensions will be allowed.
Examples
The following is an example of a filter string: Text files (.txt)|.txt|All files (.)|.
You can add several filter patterns to a filter by separating the file types with semicolons, for example:
Image Files(.BMP;.JPG;.GIF)|.BMP;.JPG;.GIF|All files (.)|. .
See Also
FilterIndex
Gets or sets the index of the filter currently selected in the file dialog box.
Declaration
public int FilterIndex { get; set; }
Property Value
System.Int32
|
Remarks
The index value of the first filter entry is 1. by default the first item is selected.
See Also
IsAppendFilesEnabled
Gets or sets a value indicating whether the append check box should be visible.
Declaration
public bool IsAppendFilesEnabled { get; set; }
Property Value
System.Boolean
|
Remarks
By default the append check box is not enabled.
IsAutomaticUpload
Gets or sets whether the file(s) should be uploaded right after they are selected.
Declaration
public bool IsAutomaticUpload { get; set; }
Property Value
System.Boolean
|
IsDeleteEnabled
Gets or sets a value indicating whether the delete button for each selected item is enabled.
Declaration
public bool IsDeleteEnabled { get; set; }
Property Value
System.Boolean
|
Remarks
By default the delete button is enabled.
IsDropFilterEnabled
Gets or sets a value indicating whether apply the Filter property to the dropped files' extension.
Declaration
public bool IsDropFilterEnabled { get; set; }
Property Value
System.Boolean
|
Remarks
By default the filtering is enabled and the filter respects the Filter and the FilterIndex properties.
IsMultiselect
Gets or sets a value indicating whether the dialog box allows multiple files to be selected.
Declaration
public bool IsMultiselect { get; set; }
Property Value
System.Boolean
|
Remarks
By default the multiple selection is enabled.
See Also
IsPauseEnabled
Gets or sets a value indicating whether the pause button is enabled.
Declaration
public bool IsPauseEnabled { get; set; }
Property Value
System.Boolean
|
Remarks
By default the pause button is enabled.
MaxFileCount
Gets or sets the maximum allowed number of files selected.
Declaration
public int MaxFileCount { get; set; }
Property Value
System.Int32
|
MaxFileSize
Gets or sets the maximum allowed size of a single file, in bytes.
Declaration
public long MaxFileSize { get; set; }
Property Value
System.Int64
|
Remarks
The size is in Bytes.
See Also
MaxUploadSize
Gets or sets the maximum Total allowed size for the selected files, in bytes.
Declaration
public long MaxUploadSize { get; set; }
Property Value
System.Int64
|
Remarks
The size is in Bytes.
See Also
OverwriteExistingFiles
Gets or sets the value indicating whether RadUpload should overwrite existing files having same name in the TargetFolder.
Declaration
public bool OverwriteExistingFiles { get; set; }
Property Value
System.Boolean
|
Remarks
When set to true, the existing files are overwritten, else no action is taken.
PauseCommand
Gets or sets a value indicating the pause command.
Declaration
public DelegateCommand PauseCommand { get; set; }
Property Value
DelegateCommand
|
ProgressValue
Gets or sets a value indicating the value of the progress.
Declaration
public double ProgressValue { get; set; }
Property Value
System.Double
|
SelectionVisibility
Gets or sets a value indicating whether SelectionVisibility is enabled.
Declaration
public Visibility SelectionVisibility { get; set; }
Property Value
System.Windows.Visibility
|
Remarks
By default SelectionVisibility is disabled.
SingleFilePerPostRequest
Gets or sets whether the file(s) should be uploaded right after they are selected.
Declaration
public bool SingleFilePerPostRequest { get; set; }
Property Value
System.Boolean
|
TargetFolder
Gets or sets the name (or child path) of the folder, where RadUpload will automatically save the valid files after the upload completes. This folder will be created or will be used as a child folder (or child path to folder) of the AppData special folder of the ASP.NET web application.
Declaration
public string TargetFolder { get; set; }
Property Value
System.String
A string containing the name of the folder. |
See Also
TargetPhysicalFolder
Gets or sets the desired physical path of the destination folder. This property is passed to the handler but not used by default due to security reasons. To read it and use it on the handler side, you need to implement custom upload handler.
Declaration
public string TargetPhysicalFolder { get; set; }
Property Value
System.String
A string containing the physical path of the folder where RadUpload will automatically save the valid files after the upload completes. |
See Also
TotalPercent
Gets or sets a value indicating the total percent.
Declaration
public string TotalPercent { get; set; }
Property Value
System.String
|
TotalSize
Identifies the MaximumProgressValue dependency property.
Declaration
public string TotalSize { get; set; }
Property Value
System.String
|
Remarks
The expected value of this property is 100d.
UploadCommand
Gets or sets a value indicating the upload command.
Declaration
public DelegateCommand UploadCommand { get; set; }
Property Value
DelegateCommand
|
UploadServiceUrl
Gets or sets the url to the UploadService.
Declaration
public string UploadServiceUrl { get; set; }
Property Value
System.String
|
Remarks
The Upload handler should be on the same server where the silverlight page is hosted.
Examples
Code sample:
<telerik:RadUpload
TargetFolder="~/Uploads"
UploadServiceUrl="/Ag/RadUploadHandler.ashx"
/>
.
Methods
add_DuplicateFileName(DuplicateFileNameFoundEventHandler)
Declaration
public void add_DuplicateFileName(DuplicateFileNameFoundEventHandler value)
Parameters
DuplicateFileNameFoundEventHandler
value
|
add_FilesSelected(FilesSelectedEventHandler)
Declaration
public void add_FilesSelected(FilesSelectedEventHandler value)
Parameters
FilesSelectedEventHandler
value
|
add_FileTooLarge(FileTooLargeEventHandler)
Declaration
public void add_FileTooLarge(FileTooLargeEventHandler value)
Parameters
FileTooLargeEventHandler
value
|
add_FileUploaded(FilesUploadedEventHandler)
Declaration
public void add_FileUploaded(FilesUploadedEventHandler value)
Parameters
FilesUploadedEventHandler
value
|
add_FileUploadFailed(FileUploadFailedEventHandler)
Declaration
public void add_FileUploadFailed(FileUploadFailedEventHandler value)
Parameters
FileUploadFailedEventHandler
value
|
add_UploadStarted(UploadStartedEventHandler)
Declaration
public void add_UploadStarted(UploadStartedEventHandler value)
Parameters
UploadStartedEventHandler
value
|
CancelUpload()
Cancels the upload.
Declaration
public void CancelUpload()
GetContainerForItemOverride()
Creates or identifies the element that is used to display the given item.
Declaration
protected override DependencyObject GetContainerForItemOverride()
Returns
System.Windows.DependencyObject
The element that is used to display the given item. |
IsItemItsOwnContainerOverride(Object)
Determines if the specified item is (or is eligible to be) its own container.
Declaration
protected override bool IsItemItsOwnContainerOverride(object item)
Parameters
System.Object
item
The item to check. |
Returns
System.Boolean
True if the item is (or is eligible to be) its own container; otherwise, false. |
OnApplyTemplate()
When overridden in a derived class, is invoked whenever application code or internal processes (such as a rebuilding layout pass) call System.Windows.Controls.Control.ApplyTemplate.
Declaration
public override void OnApplyTemplate()
OnDrop(DragEventArgs)
Invoked on the System.Windows.UIElement.Drop event.
Declaration
protected override void OnDrop(DragEventArgs e)
Parameters
System.Windows.DragEventArgs
e
The data for the event. |
OnDuplicateFileName(RadUploadSelectedFile)
Called when [duplicate file name].
Declaration
protected virtual void OnDuplicateFileName(RadUploadSelectedFile file)
Parameters
RadUploadSelectedFile
file
The file. |
OnItemsChanged(NotifyCollectionChangedEventArgs)
Invoked when the Items collection changes.
Declaration
protected override void OnItemsChanged(NotifyCollectionChangedEventArgs e)
Parameters
System.Collections.Specialized.NotifyCollectionChangedEventArgs
e
|
PauseUpload()
Pauses the upload.
Declaration
public void PauseUpload()
PrepareContainerForItemOverride(DependencyObject, Object)
Prepares the specified element to display the specified item.
Declaration
protected override void PrepareContainerForItemOverride(DependencyObject element, object item)
Parameters
System.Windows.DependencyObject
element
Element used to display the specified item. |
System.Object
item
Specified item. |
PrepareSelectedFilesForUpload()
Verifies whether the selected files are valid.
Declaration
public void PrepareSelectedFilesForUpload()
ProcessDroppedData(DragEventArgs)
Process the data dropped over the control.
Declaration
public void ProcessDroppedData(DragEventArgs e)
Parameters
System.Windows.DragEventArgs
e
The data from the Drop event. |
remove_DuplicateFileName(DuplicateFileNameFoundEventHandler)
Declaration
public void remove_DuplicateFileName(DuplicateFileNameFoundEventHandler value)
Parameters
DuplicateFileNameFoundEventHandler
value
|
remove_FilesSelected(FilesSelectedEventHandler)
Declaration
public void remove_FilesSelected(FilesSelectedEventHandler value)
Parameters
FilesSelectedEventHandler
value
|
remove_FileTooLarge(FileTooLargeEventHandler)
Declaration
public void remove_FileTooLarge(FileTooLargeEventHandler value)
Parameters
FileTooLargeEventHandler
value
|
remove_FileUploaded(FilesUploadedEventHandler)
Declaration
public void remove_FileUploaded(FilesUploadedEventHandler value)
Parameters
FilesUploadedEventHandler
value
|
remove_FileUploadFailed(FileUploadFailedEventHandler)
Declaration
public void remove_FileUploadFailed(FileUploadFailedEventHandler value)
Parameters
FileUploadFailedEventHandler
value
|
remove_UploadStarted(UploadStartedEventHandler)
Declaration
public void remove_UploadStarted(UploadStartedEventHandler value)
Parameters
UploadStartedEventHandler
value
|
ResumeUpload()
Resumes the upload.
Declaration
public void ResumeUpload()
ShowFileDialog()
Shows the file dialog.
Declaration
public void ShowFileDialog()
StartUpload()
Starts the upload.
Declaration
public void StartUpload()
Events
DuplicateFileName
Occurs when a duplicate file name is selected.
Declaration
public event DuplicateFileNameFoundEventHandler DuplicateFileName
Event Type
DuplicateFileNameFoundEventHandler
|
FileCountExceeded
Occurs when a user has selected more that the allowed files count. See MaxFileCount property.
Declaration
public event RoutedEventHandler FileCountExceeded
Event Type
System.Windows.RoutedEventHandler
|
FilesSelected
Occurs when the files are selected from the user.
Declaration
public event FilesSelectedEventHandler FilesSelected
Event Type
FilesSelectedEventHandler
|
FileTooLarge
Occurs when a file that is selected is too large. See MaxFileSize property.
Declaration
public event FileTooLargeEventHandler FileTooLarge
Event Type
FileTooLargeEventHandler
|
Remarks
You can handle the FileSelected event and check the CurrentSession's TooLargeFiles collection instead.
FileUploaded
Occurs when the file is uploaded.
Declaration
public event FilesUploadedEventHandler FileUploaded
Event Type
FilesUploadedEventHandler
|
FileUploadFailed
Occurs when the file failed to upload.
Declaration
public event FileUploadFailedEventHandler FileUploadFailed
Event Type
FileUploadFailedEventHandler
|
FileUploadStarting
Occurs when the file is prepared for upload.
Declaration
public event EventHandler<FileUploadStartingEventArgs> FileUploadStarting
Event Type
System.EventHandler<FileUploadStartingEventArgs>
|
ProgressChanged
Occurs when the progress of the upload session is changed.
Declaration
public event RoutedEventHandler ProgressChanged
Event Type
System.Windows.RoutedEventHandler
|
UploadCanceled
Occurs when upload session is canceled.
Declaration
public event RoutedEventHandler UploadCanceled
Event Type
System.Windows.RoutedEventHandler
|
UploadFinished
Occurs when upload session is finished.
Declaration
public event RoutedEventHandler UploadFinished
Event Type
System.Windows.RoutedEventHandler
|
UploadPaused
Occurs when upload session is paused.
Declaration
public event RoutedEventHandler UploadPaused
Event Type
System.Windows.RoutedEventHandler
|
UploadResumed
Occurs when upload session is resumed.
Declaration
public event RoutedEventHandler UploadResumed
Event Type
System.Windows.RoutedEventHandler
|
UploadSizeExceeded
Occurs when the size of the selected files is too large. See MaxUploadSize property.
Declaration
public event RoutedEventHandler UploadSizeExceeded
Event Type
System.Windows.RoutedEventHandler
|
UploadStarted
Occurs when the upload has started.
Declaration
public event UploadStartedEventHandler UploadStarted
Event Type
UploadStartedEventHandler
|