Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RadzenUpload Component doesn't send request with file #1508

Closed
walik92 opened this issue May 17, 2024 · 1 comment
Closed

RadzenUpload Component doesn't send request with file #1508

walik92 opened this issue May 17, 2024 · 1 comment

Comments

@walik92
Copy link

walik92 commented May 17, 2024

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
@enchev enchev closed this as completed May 17, 2024
@enchev enchev reopened this May 17, 2024
@enchev
Copy link
Collaborator

enchev commented May 21, 2024

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();
        }
    }
}

@enchev enchev closed this as completed May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants