Demos About Radzen
Search Results for

    Show / Hide Table of Contents

    Class RadzenUpload

    RadzenUpload component.

    Inheritance
    System.Object
    RadzenComponent
    RadzenUpload
    Implements
    IDisposable
    Inherited Members
    RadzenComponent.Attributes
    RadzenComponent.Element
    RadzenComponent.MouseEnter
    RadzenComponent.MouseLeave
    RadzenComponent.ContextMenu
    RadzenComponent.Culture
    RadzenComponent.DefaultCulture
    RadzenComponent.OnMouseEnter()
    RadzenComponent.OnMouseLeave()
    RadzenComponent.OnContextMenu(Microsoft.AspNetCore.Components.Web.MouseEventArgs)
    RadzenComponent.Style
    RadzenComponent.Visible
    RadzenComponent.GetCssClass()
    RadzenComponent.GetId()
    RadzenComponent.Debounce(Func<Task>, Int32)
    RadzenComponent.UniqueID
    RadzenComponent.JSRuntime
    RadzenComponent.IsJSRuntimeAvailable
    RadzenComponent.OnInitialized()
    RadzenComponent.Reference
    RadzenComponent.RaiseContextMenu(Microsoft.AspNetCore.Components.Web.MouseEventArgs)
    RadzenComponent.RaiseMouseEnter()
    RadzenComponent.RaiseMouseLeave()
    RadzenComponent.Dispose()
    RadzenComponent.CurrentStyle
    Namespace: Radzen.Blazor
    Assembly: Radzen.Blazor.dll
    Syntax
    public class RadzenUpload : RadzenComponent, IDisposable
    Examples
    <RadzenUpload Url="upload/single" Progress=@(args => OnProgress(args, "Single file upload"))/>
    @code {
     void OnProgress(UploadProgressArgs args, string name)
     {
       this.info = $"% '{name}' / {args.Loaded} of {args.Total} bytes.";
       this.progress = args.Progress;
       if (args.Progress == 100)
       {
           console.Clear();
    
           foreach (var file in args.Files)
           {
               console.Log($"Uploaded: {file.Name} / {file.Size} bytes");
           }
       }
     }
    }

    Fields

    fileUpload

    Gets file input reference.

    Declaration
    protected ElementReference fileUpload
    Field Value
    Type Description
    ElementReference

    Properties

    Accept

    Gets or sets the accepted MIME types.

    Declaration
    public string Accept { get; set; }
    Property Value
    Type Description
    System.String

    The accepted MIME types.

    Auto

    Gets or sets a value indicating whether this RadzenUpload upload is automatic.

    Declaration
    public bool Auto { get; set; }
    Property Value
    Type Description
    System.Boolean

    true if upload automatic; otherwise, false.

    Change

    Gets or sets the change callback.

    Declaration
    public EventCallback<UploadChangeEventArgs> Change { get; set; }
    Property Value
    Type Description
    EventCallback<UploadChangeEventArgs>

    The change callback.

    ChildContent

    Gets or sets the child content.

    Declaration
    public RenderFragment ChildContent { get; set; }
    Property Value
    Type Description
    RenderFragment

    The child content.

    ChooseText

    Gets or sets the choose button text.

    Declaration
    public string ChooseText { get; set; }
    Property Value
    Type Description
    System.String

    The choose button text.

    Complete

    Gets or sets the complete callback.

    Declaration
    public EventCallback<UploadCompleteEventArgs> Complete { get; set; }
    Property Value
    Type Description
    EventCallback<UploadCompleteEventArgs>

    The complete callback.

    DeleteText

    Gets or sets the choose button text.

    Declaration
    public string DeleteText { get; set; }
    Property Value
    Type Description
    System.String

    The choose button text.

    Disabled

    Gets or sets a value indicating whether this RadzenUpload is disabled.

    Declaration
    public bool Disabled { get; set; }
    Property Value
    Type Description
    System.Boolean

    true if disabled; otherwise, false.

    Error

    Gets or sets the error callback.

    Declaration
    public EventCallback<UploadErrorEventArgs> Error { get; set; }
    Property Value
    Type Description
    EventCallback<UploadErrorEventArgs>

    The error callback.

    HasValue

    Gets a value indicating whether this instance has value.

    Declaration
    public bool HasValue { get; }
    Property Value
    Type Description
    System.Boolean

    true if this instance has value; otherwise, false.

    Icon

    Gets or sets the icon.

    Declaration
    public string Icon { get; set; }
    Property Value
    Type Description
    System.String

    The icon.

    IconColor

    Gets or sets the icon color.

    Declaration
    public string IconColor { get; set; }
    Property Value
    Type Description
    System.String

    The icon color.

    ImageAlternateText

    Gets or sets the text.

    Declaration
    public string ImageAlternateText { get; set; }
    Property Value
    Type Description
    System.String

    The text.

    InputAttributes

    Specifies additional custom attributes that will be rendered by the input.

    Declaration
    public IReadOnlyDictionary<string, object> InputAttributes { get; set; }
    Property Value
    Type Description
    IReadOnlyDictionary<System.String, System.Object>

    The attributes.

    MaxFileCount

    Gets or sets the maximum number of files.

    Declaration
    public int MaxFileCount { get; set; }
    Property Value
    Type Description
    System.Int32

    The maximum number of files.

    Multiple

    Gets or sets a value indicating whether this RadzenUpload is multiple.

    Declaration
    public bool Multiple { get; set; }
    Property Value
    Type Description
    System.Boolean

    true if multiple; otherwise, false.

    Name

    Gets or sets the name.

    Declaration
    public string Name { get; set; }
    Property Value
    Type Description
    System.String

    The name.

    ParameterName

    Gets or sets the parameter name. If not set 'file' parameter name will be used for single file and 'files' for multiple files.

    Declaration
    public string ParameterName { get; set; }
    Property Value
    Type Description
    System.String

    The parameter name.

    Progress

    Gets or sets the progress callback.

    Declaration
    public EventCallback<UploadProgressArgs> Progress { get; set; }
    Property Value
    Type Description
    EventCallback<UploadProgressArgs>

    The progress callback.

    Url

    Gets or sets the URL.

    Declaration
    public string Url { get; set; }
    Property Value
    Type Description
    System.String

    The URL.

    Methods

    ClearFiles()

    Clear selected file(s) from the upload selection

    Declaration
    public async Threading.Tasks.Task ClearFiles()
    Returns
    Type Description
    System.Threading.Tasks.Task

    GetComponentCssClass()

    Gets the component CSS class.

    Declaration
    protected override string GetComponentCssClass()
    Returns
    Type Description
    System.String
    Overrides
    RadzenComponent.GetComponentCssClass()

    GetHeaders()

    Gets the headers.

    Declaration
    public IDictionary<string, string> GetHeaders()
    Returns
    Type Description
    IDictionary<System.String, System.String>

    IDictionary<System.String, System.String>.

    OnAfterRenderAsync(Boolean)

    Called by the Blazor runtime.

    Declaration
    protected override async Task OnAfterRenderAsync(bool firstRender)
    Parameters
    Type Name Description
    System.Boolean firstRender
    Returns
    Type Description
    Task
    Overrides
    RadzenComponent.OnAfterRenderAsync(Boolean)

    OnChange(IEnumerable<PreviewFileInfo>)

    Called on file change.

    Declaration
    public async Threading.Tasks.Task OnChange(IEnumerable<PreviewFileInfo> files)
    Parameters
    Type Name Description
    IEnumerable<PreviewFileInfo> files

    The files.

    Returns
    Type Description
    System.Threading.Tasks.Task

    OnComplete(String, Boolean)

    Called when upload is complete.

    Declaration
    public async Threading.Tasks.Task OnComplete(string response, bool cancelled)
    Parameters
    Type Name Description
    System.String response

    The response.

    System.Boolean cancelled

    Flag indicating if the upload was cancelled

    Returns
    Type Description
    System.Threading.Tasks.Task

    OnError(String)

    Called on upload error.

    Declaration
    public async Threading.Tasks.Task OnError(string error)
    Parameters
    Type Name Description
    System.String error

    The error.

    Returns
    Type Description
    System.Threading.Tasks.Task

    OnProgress(Int32, Int64, Int64, IEnumerable<FileInfo>, Boolean)

    Called on progress.

    Declaration
    public async Threading.Tasks.Task<bool> OnProgress(int progress, long loaded, long total, IEnumerable<FileInfo> files, bool cancel)
    Parameters
    Type Name Description
    System.Int32 progress

    The progress.

    System.Int64 loaded

    The loaded.

    System.Int64 total

    The total.

    IEnumerable<FileInfo> files

    The files.

    System.Boolean cancel

    The cancelled state.

    Returns
    Type Description
    System.Threading.Tasks.Task<System.Boolean>

    OnRemove(PreviewFileInfo, Boolean)

    Called on file remove.

    Declaration
    protected async Threading.Tasks.Task OnRemove(PreviewFileInfo file, bool fireChangeEvent = true)
    Parameters
    Type Name Description
    PreviewFileInfo file

    The file.

    System.Boolean fireChangeEvent

    If the linked Change event should be fired as a result of this removal (default: true)

    Returns
    Type Description
    System.Threading.Tasks.Task

    RemoveFile(String, Boolean)

    Called on file remove.

    Declaration
    public async Threading.Tasks.Task RemoveFile(string fileName, bool ignoreCase = false)
    Parameters
    Type Name Description
    System.String fileName

    The name of the file to remove.

    System.Boolean ignoreCase

    Specify true is file name casing should be ignored (default: false)

    Returns
    Type Description
    System.Threading.Tasks.Task

    SetParametersAsync(ParameterView)

    Called by the Blazor runtime when parameters are set.

    Declaration
    public override async Task SetParametersAsync(ParameterView parameters)
    Parameters
    Type Name Description
    ParameterView parameters

    The parameters.

    Returns
    Type Description
    Task
    Overrides
    RadzenComponent.SetParametersAsync(ParameterView)

    Upload()

    Uploads this instance selected files.

    Declaration
    public async Task Upload()
    Returns
    Type Description
    Task

    Implements

    IDisposable

    Introducing Radzen Blazor Studio

    Radzen Blazor Studio is a software development environment that empowers developers to design, build and deploy Blazor applications without the traditional hurdles. Write less code and get more done.

    Learn More

    Download Now
    Download Now
    In This Article
    Back to top Radzen Blazor Components, © 2018-2025 Radzen. Source Code licensed under MIT