blazor-devexpress-dot-blazor-dot-dxupload-2d5165cc.md
Specifies how the Upload component uploads files to the server.
Namespace : DevExpress.Blazor
Assembly : DevExpress.Blazor.v25.2.dll
NuGet Package : DevExpress.Blazor
[DefaultValue(UploadMode.Instant)]
[Parameter]
public UploadMode UploadMode { get; set; }
| Type | Default | Description |
|---|---|---|
| UploadMode | Instant |
A UploadMode enumeration value.
|
Available values:
| Name | Description |
|---|---|
| Instant |
Files are uploaded instantly when a user selects or drops them.
| | OnButtonClick |
Files are uploaded after a user clicks the common upload button or individual buttons for each file.
|
Use the UploadMode property to specify how the Upload component uploads files to the server. The following upload modes are available:
The following code snippet enables the UploadMode.OnButtonClick upload mode in the component.
<DxUpload Name="myFile"
UploadUrl="@GetUploadUrl("api/Upload/Upload/")"
UploadMode="UploadMode.OnButtonClick">
</DxUpload>
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace BlazorDemo.AspNetCoreHost;
[Route("api/[controller]")]
[ApiController]
public class UploadController : ControllerBase {
[HttpPost("[action]")]
public ActionResult Upload(IFormFile myFile) {
try {
// Write code that saves the 'myFile' file.
// Don't rely on or trust the FileName property without validation.
} catch {
return BadRequest();
}
return Ok();
}
}
Run Demo: Upload - Upload Modes
See Also