blazor-devexpress-dot-blazor-f93e460a.md
Lists values that define how the Upload component uploads files to the server.
Namespace : DevExpress.Blazor
Assembly : DevExpress.Blazor.v25.2.dll
NuGet Package : DevExpress.Blazor
public enum UploadMode
| 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.
|
The following properties accept/return UploadMode values:
The following code snippet enables the UploadMode.OnButtonClick upload mode in the component.
<DxUpload Name="myFile"
UploadUrl="https://localhost:10000/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