Overview

Drag and Drop File Hereor
Uploads are limited to a single file up to 15 MB.

Note: Before adding file upload capabilities to your Blazor app, make certain to institute necessary security-related processes (to avoid risks and control unauthorized file operations).

DevExpress Blazor UI Component Library includes two components that allow you to handle file upload: DxUpload and DxFileInput. Both these components allow you to upload files to a server, send them to another destination, or save them to the file system. The key difference between these components is that the Upload component requires creating a separate web API controller to upload files, while the File Input component gives you direct and secure access to selected files in Razor code.

With the File Input component, users can select files in the Open File dialog or drag and drop files onto the drop zone. The FilesUploading event occurs once an upload operation begins. Handle this event to access the selected files and call a file's OpenReadStream method to read file content.

This demo implements an external Select File button and a drop zone container for the File Input component. When the file list is empty, the File Input component is hidden. To customize the component's appearance and behavior, the demo uses the following API members:

 Display Uploaded Image on Page

Profile Picture
Drag & Drop the desired file …or click to browse for a file instead.
Uploads are limited to a single file up to 15 MB. Allowed file extensions: .jpg, .jpeg, .gif, .png.

In this demo, the File Input component allows you to select a JPG, JPEG, GIF, or PNG image (up to 15MB in size). The FilesUploading event handler uploads the selected image directly to the web page and displays it in the drop zone container.

 Multiple File Selection

Click the button below to start your upload
You can upload multiple files, each up to 15 MB.

In this demo, users can upload multiple files simultaneously. Set the AllowMultiFileUpload property to true to enable this behavior.

 Upload Modes

Click the button below to start your upload
You can upload multiple files, each up to 15 MB.

Use the UploadMode property to specify how the File Input component uploads files:

  • Instant (Default) — The component starts uploading a file once a user selects or drops it.
  • OnButtonClick — The component starts uploading a file once a user clicks an upload button.

In this demo, the File Input component uses OnButtonClick upload mode.