New to Telerik UI for BlazorStart a free 30-day trial

A component that lets users select and upload files with progress, validation, and events. Supports endpoints via SaveUrl/RemoveUrl and form keys SaveField/RemoveField, credentials with WithCredentials, auto/manual upload through AutoUpload, multiple selection, allowed extensions and size limits, chunk upload via UploadChunkSettings, preloaded Files, and lifecycle events (OnSelect, OnUpload, OnProgress, OnSuccess, OnError, OnCancel, OnClear, OnPause, OnResume).

Definition

Namespace:Telerik.Blazor.Components

Assembly:Telerik.Blazor.dll

Syntax:

C#
public class TelerikUpload : TelerikUploadBase<UploadFileInfo, UploadFileTemplateContext, UploadFileInfoTemplateContext>, IComponent, IHandleEvent, IHandleAfterRender, IDisposable

Inheritance: objectComponentBaseBaseComponentTelerikUploadBase<UploadFileInfo, UploadFileTemplateContext, UploadFileInfoTemplateContext>TelerikUpload

Implements: IComponentIDisposableIHandleAfterRenderIHandleEvent

Inherited Members TelerikUploadBase<UploadFileInfo, UploadFileTemplateContext, UploadFileInfoTemplateContext>.OnAfterRenderAsync(bool)TelerikUploadBase<UploadFileInfo, UploadFileTemplateContext, UploadFileInfoTemplateContext>.ClearFiles()TelerikUploadBase<UploadFileInfo, UploadFileTemplateContext, UploadFileInfoTemplateContext>.OpenSelectFilesDialog()TelerikUploadBase<UploadFileInfo, UploadFileTemplateContext, UploadFileInfoTemplateContext>.SelectFilesButtonTemplateTelerikUploadBase<UploadFileInfo, UploadFileTemplateContext, UploadFileInfoTemplateContext>.EnabledTelerikUploadBase<UploadFileInfo, UploadFileTemplateContext, UploadFileInfoTemplateContext>.MultipleTelerikUploadBase<UploadFileInfo, UploadFileTemplateContext, UploadFileInfoTemplateContext>.AcceptTelerikUploadBase<UploadFileInfo, UploadFileTemplateContext, UploadFileInfoTemplateContext>.AllowedExtensionsTelerikUploadBase<UploadFileInfo, UploadFileTemplateContext, UploadFileInfoTemplateContext>.MinFileSizeTelerikUploadBase<UploadFileInfo, UploadFileTemplateContext, UploadFileInfoTemplateContext>.MaxFileSizeTelerikUploadBase<UploadFileInfo, UploadFileTemplateContext, UploadFileInfoTemplateContext>.IdTelerikUploadBase<UploadFileInfo, UploadFileTemplateContext, UploadFileInfoTemplateContext>.CaptureTelerikUploadBase<UploadFileInfo, UploadFileTemplateContext, UploadFileInfoTemplateContext>.DropZoneIdTelerikUploadBase<UploadFileInfo, UploadFileTemplateContext, UploadFileInfoTemplateContext>.AriaDescribedByTelerikUploadBase<UploadFileInfo, UploadFileTemplateContext, UploadFileInfoTemplateContext>.AriaLabelledByTelerikUploadBase<UploadFileInfo, UploadFileTemplateContext, UploadFileInfoTemplateContext>.FilesTelerikUploadBase<UploadFileInfo, UploadFileTemplateContext, UploadFileInfoTemplateContext>.FileTemplateTelerikUploadBase<UploadFileInfo, UploadFileTemplateContext, UploadFileInfoTemplateContext>.FileInfoTemplateBaseComponent.ShouldRender()BaseComponent.OnInitializedAsync()BaseComponent.OnAfterRenderAsync(bool)BaseComponent.Dispose()BaseComponent.InitLocalizer()BaseComponent.ThrowIfParameterIsNull(object, string)BaseComponent.HaveOptionsChanged(IDictionary<string, object>, IDictionary<string, object>)BaseComponent.GetClassString(params string[])BaseComponent.InvokeAsync<T>(string, params object[])BaseComponent.InvokeAsync<T>(string, CancellationToken, params object[])BaseComponent.InvokeVoidAsync(string, params object[])BaseComponent.InvokeVoidAsyncWithoutAwait(string, params object[])BaseComponent.InvokeComponentMethodAsync<T>(string, params object[])BaseComponent.InvokeComponentMethodAsync<T>(string, CancellationToken, params object[])BaseComponent.InvokeVoidComponentMethodAsync(string, params object[])BaseComponent.InvokeComponentVoidMethodAsync(string, object)BaseComponent.InvokeDisposeAsync()BaseComponent.StateHasChanged()BaseComponent.RootComponentBaseComponent.ClassComponentBase.OnParametersSet()ComponentBase.OnParametersSetAsync()ComponentBase.OnAfterRender(bool)ComponentBase.InvokeAsync(Action)ComponentBase.InvokeAsync(Func<Task>)ComponentBase.DispatchExceptionAsync(Exception)ComponentBase.SetParametersAsync(ParameterView)...

Constructors

C#
public TelerikUpload()

Properties

Automatically uploads files after selection when set to true (default). Set to false to require a manual upload button click. Example: false.

C#
[Parameter]
public bool AutoUpload { get; set; }

Preloads a list of files into the Upload component on initialization. Example: bind to a list of UploadFileInfo. Useful for displaying previously uploaded files.

C#
[Parameter]
public IEnumerable<UploadFileInfo> Files { get; set; }

Fires when a user clicks Cancel on a file that is uploading. Use to stop upload and update UI. Example: cancel upload of large file.

C#
[Parameter]
public EventCallback<UploadCancelEventArgs> OnCancel { get; set; }

Fires when the Clear button is clicked. Use to reset the file list or clear UI. Example: remove all files from the list.

C#
[Parameter]
public EventCallback<UploadClearEventArgs> OnClear { get; set; }

Fires when an upload or remove request fails. Use to display error messages or retry logic. Example: show error notification if server returns 500.

C#
[Parameter]
public EventCallback<UploadErrorEventArgs> OnError { get; set; }

Fires when the Pause button is clicked. Use to pause chunked uploads. Only available when chunk upload and Resumable are enabled.

C#
[Parameter]
public EventCallback<UploadPauseEventArgs> OnPause { get; set; }

Fires when upload progress changes. Use to update progress bars or UI. Example: show "Uploading 50%".

C#
[Parameter]
public EventCallback<UploadProgressEventArgs> OnProgress { get; set; }

Fires when a user clicks Remove (X) on a file. Use to handle file deletion logic. Example: remove file from server or update UI. See OnError for failure handling.

C#
[Parameter]
public EventCallback<UploadEventArgs> OnRemove { get; set; }

Fires when the Resume button is clicked. Use to resume paused chunked uploads. Only available when chunk upload and Resumable are enabled.

C#
[Parameter]
public EventCallback<UploadResumeEventArgs> OnResume { get; set; }

Fires when users select new files for upload. Use to validate or filter files before upload. Example: check file type or size. See OnUpload for upload logic.

C#
[Parameter]
public EventCallback<UploadSelectEventArgs> OnSelect { get; set; }

Fires when an upload or remove request succeeds. Use to update UI or notify users. Example: show "Upload complete" message.

C#
[Parameter]
public EventCallback<UploadSuccessEventArgs> OnSuccess { get; set; }

Fires before uploading files. Use to add custom headers or cancel upload. Example: set args.IsCancelled = true to prevent upload. Fires after OnSelect unless AutoUpload is false.

C#
[Parameter]
public EventCallback<UploadEventArgs> OnUpload { get; set; }
C#
public string PopupId { get; }

Sets the FormData key for file names sent to RemoveUrl. Example: "files". Change if your server expects a different key.

C#
[Parameter]
public string RemoveField { get; set; }

Sets the URL endpoint for removing uploaded files. Example: "https://myserver.com/remove". Must be configured for file deletion to work. See SaveUrl for upload endpoint.

C#
[Parameter]
public string RemoveUrl { get; set; }

Sets the FormData key for uploaded files sent to SaveUrl. Example: "files". Change if your server expects a different key.

C#
[Parameter]
public string SaveField { get; set; }

Sets the URL endpoint that receives uploaded files. Example: "https://myserver.com/upload". Required for file uploads to work. See RemoveUrl for file removal.

C#
[Parameter]
public string SaveUrl { get; set; }

Configures advanced upload settings, such as chunk upload. Use UploadChunkSettings as a child component. Example: .

C#
[Parameter]
public RenderFragment UploadSettings { get; set; }

Enables sending credentials (cookies, headers) with cross-site requests. Set to true if your upload endpoint requires authentication. Example: true.

C#
[Parameter]
public bool WithCredentials { get; set; }

Methods

C#
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters:__builderRenderTreeBuilder

Overrides: ComponentBase.BuildRenderTree(RenderTreeBuilder)

Cancels the upload of the specified file and removes it from the collection.

C#
public void CancelFile(string fileId)
Parameters:fileIdstring

The unique identifier of the file to cancel.

C#
protected override void OnInitialized()

Overrides: ComponentBase.OnInitialized()

Pauses the upload of the file with the specified identifier, if it exists in the current collection.

C#
public void PauseFile(string fileId)
Parameters:fileIdstring

The unique identifier of the file to pause.

Removes the file with the specified identifier from the collection.

C#
public void RemoveFile(string fileId)
Parameters:fileIdstring

The unique identifier of the file to remove.

Resumes the upload process for the specified file.

C#
public void ResumeFile(string fileId)
Parameters:fileIdstring

The unique identifier of the file to resume.

Attempts to retry the upload of a file with the specified identifier.

C#
public void RetryFile(string fileId)
Parameters:fileIdstring

The unique identifier of the file to retry.

Uploads all valid files.

C#
public void UploadFiles()