DxUpload.UploadUrl Property

Specifies a target URL for the upload request.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v21.1.dll


public string UploadUrl { get; set; }

Property Value

Type Description

A string value that specifies a target URL.


Set the UploadUrl property to a path of a server-side controller’s action that processes upload requests. You should also specify the Name property to associate the Upload component with the server.

<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, safity, and so on). 
                // If all checks are passed, save the file.
        } catch {
            Response.StatusCode = 400;

        return new EmptyResult();

Run Demo: Upload - Overview

See Also