radzenhq / radzen-blazor

Radzen Blazor is a set of 70+ free native Blazor UI components packed with DataGrid, Scheduler, Charts and robust theming including Material design and FluentUI.

Home Page:https://www.radzen.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RadzenUpload Component doesn't send request with file

walik92 opened this issue · comments

Describe the bug
Since 4.28.4 RadzenUpload component doesn't send request with file to server. There isn't any error in console of browser.

To Reproduce
To reproduce BUG use below code:

<RadzenRow>
    <RadzenColumn Size="12">
        <RadzenUpload @ref="_upload" Accept=".png, .jpg, .jpeg, .tif, .tiff, .bmp, .pdf, .doc, .docx" ChooseText="Choose" Auto="false" Multiple="true" class="w-100">
        </RadzenUpload>
    </RadzenColumn>
</RadzenRow>
<RadzenRow class="mt-3">
    <RadzenColumn Size="12">
        <RadzenStack Orientation="Orientation.Horizontal" AlignItems="AlignItems.Center" JustifyContent="JustifyContent.End" Gap="10px">
            <RadzenButton Text="Add" Click="Submit" ButtonStyle="ButtonStyle.Primary"/>
        </RadzenStack>
    </RadzenColumn>
</RadzenRow>

@code {

    [Parameter]
    public Guid EnrollmentId { get; set; }

    RadzenUpload _upload = null!;

    async Task Submit()
    {
        _upload.Url = $"/api/enrollments/{EnrollmentId}/attachments";
        if (_upload.HasValue)
        {
            // this method doesn't send request and nothing happen
            await _upload.Upload();
        }
    }
}

Expected behavior
Executing 'Upload' method of '_upload' object will send request with file.

Desktop

  • OS: Windows 11
  • Browser Chrome 124.0.6367.203
  • Version Radzen Blazor WASM 4.28.4 or higher
  • .Net Core 7

Just setting the Url like this will not work - you need to attach it to variable at least:


<RadzenRow>
    <RadzenColumn Size="12">
        <RadzenUpload @ref="_upload" Url="@url" Accept=".png, .jpg, .jpeg, .tif, .tiff, .bmp, .pdf, .doc, .docx" ChooseText="Choose" Auto="false" Multiple="true" class="w-100">
        </RadzenUpload>
    </RadzenColumn>
</RadzenRow>
<RadzenRow class="mt-3">
    <RadzenColumn Size="12">
        <RadzenStack Orientation="Orientation.Horizontal" AlignItems="AlignItems.Center" JustifyContent="JustifyContent.End" Gap="10px">
            <RadzenButton Text="Add" Click="Submit" ButtonStyle="ButtonStyle.Primary" />
        </RadzenStack>
    </RadzenColumn>
</RadzenRow>

@code {

    [Parameter]
    public Guid EnrollmentId { get; set; }

    RadzenUpload _upload = null!;
    string url;

    async Task Submit()
    {
        url = $"upload/single";
        if (_upload.HasValue)
        {
            // this method doesn't send request and nothing happen
            await _upload.Upload();
        }
    }
}