Blazor Upload - Overview
- EXAMPLE
- VIEW SOURCE
- EDIT IN TELERIK REPL
- Change Theme
default
- Overview.razor
- UploadController.cs
The Upload component is part of Telerik UI for Blazor, a professional grade UI library with 110+ native components for building modern and feature-rich applications. To try it out sign up for a free 30-day trial.
Description
The Blazor FileUpload component enables users to select and upload files asynchronously from their local devices to dedicated server handlers. File Upload offers you a rich events list to accommodate security information, application logic and even file validation.
The Telerik UI for Blazor FileUpload component helps you implement non-blocking asynchronous uploads from your users' file systems to your dedicated server endpoints.
In this demo, you can see a primary example of using a Blazor FileUpload component within an EditForm. The usage of the component is achieved via the <TelerikUpload> tag with configured addresses for upload and removal, handlers for file selection, saving and canceling of the upload operation. Further, the FileUpload is configured to validate the allowed file extensions—in this case these are limited to only .pdf and .docx extensions. In case users try to upload a different file format and submit the form, a validation error message is displayed to indicate the corrections that need to be made.
In addition to the built-in client-side validation for file size and type, the Upload UI component for Blazor allows custom validation that can take place in the OnSelect event. Please note that for large file uploads, you can use the MaxFileSize parameter only in client-side validation. For the server-side validation, you may need to configure separately the corresponding server parameters (for IIS IIS maxAllowedContentLength, for Kestrel MaxRequestBodySize etc.)
The Telerik Upload for Blazor component also exposes numerous events for handling file selection, upload progress, error handling, canceling, clearing and removing of uploaded files.