Skip to main content

DxUpload.Name Property

Specifies a unique identifier used to associate the Upload component with uploaded files on the server.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v22.1.dll


public string Name { get; set; }

Property Value

Type Description

A string value that specifies the identifier.


Specify the Name property to associate the Upload component with the server. This property is used to access uploaded files on the server. You should also set the UploadUrl property to the path of a server-side controller’s action that processes upload requests.

<DxUpload Name="myFile" 

On the server side, create a controller with an action that accepts the uploaded file, checks it, and saves it to the target location.

Do one of the following to access the uploaded file:

  • Create an action with a parameter whose name matches the Name property value.

    public ActionResult UploadFile(IFormFile myFile) {
        // ...
  • Use the Name property value to get the uploaded file from form variables.

    public ActionResult UploadFile() {
        // ...
        var myFile = Request.Form.Files["myFile"];
        // ...

The following example demonstrates how to implement the upload controller:

using System.IO;
using System.Linq;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

public class UploadController : ControllerBase {
    private readonly IWebHostEnvironment _hostingEnvironment;

    public UploadController(IWebHostEnvironment hostingEnvironment) {
        _hostingEnvironment = hostingEnvironment;

    // "myFile" is the value of the Upload's "Name" property.
    public ActionResult UploadFile(IFormFile myFile) {
        try {
            // Specify the target location for the uploaded files.
            var path = Path.Combine(_hostingEnvironment.WebRootPath, "uploads");
            // Check whether the target directory exists; otherwise, create it.
            if (!Directory.Exists(path))
            using (var fileStream = System.IO.File.Create(Path.Combine(path, myFile.FileName))) {
                // Check the file here (its extension, safety, and so on). 
                // If all checks are passed, save the file.
        } catch {
            Response.StatusCode = 400;

        return new EmptyResult();

Run Demo: Upload - Overview

See Also