SfUploader: calling await Uploader.GetFilesDataAsync() breaks the file validation process

Hello, I have a problem with SfUploader. When I call await Uploader.GetFilesDataAsync() and then hit Upload button the validation says that the filetype is not allowed regardless the attribute AllowedExtensions configuration.

@page "/"

@using Syncfusion.Blazor

@using Syncfusion.Blazor.Data

@using Syncfusion.Blazor.DropDowns

@using Syncfusion.Blazor.Inputs

<PageTitle>Index</PageTitle>


<h1>Demo</h1>


<EditForm Model="@example_model" OnValidSubmit="@Sending">

    <DataAnnotationsValidator />

    <ol>

        <li>Select any file with the alowed extension: .doc, .docx, .xls, .xlsx, .ppt, .pptx, .jpg, .jpeg, .png, .gif, .pdf</li>

        <li>Press send</li>

        <li>Press Press Upload to see the error</li>

        <li>Comment line 34 "List<FileInfo> all_files = await Uploader.GetFilesDataAsync();" and restart the application. Then follow those steps again.</li>

    </ol>

    <SfUploader @ref="Uploader" AutoUpload="false" AllowedExtensions=".doc, .docx, .xls, .xlsx, .ppt, .pptx, .jpg, .jpeg, .png, .gif, .pdf" MaxFileSize=52428800>


    </SfUploader>


    <div class="form-row botones">

        <div class="form-group float-right">

            <button type="submit" class="btn btn-primary">Send</button>

        </div>

    </div>

</EditForm>

@code {

    SfUploader Uploader;

    ExampleModelDTO example_model = new ExampleModelDTO();

    private async Task Sending()

    {

        //List<FileInfo> all_files = await Uploader.GetFilesDataAsync();

        return;

    }


    public class ExampleModelDTO

    {


        public string Name { get; set; }

    }


Project attached



Attachment: DemoUploadFailed_d24d3fba.zip

1 Reply 1 reply marked as answer

UD UdhayaKumar Duraisamy Syncfusion Team August 31, 2022 08:10 AM UTC

Hi Adrián,


We have validated the reported query on our end and we found that you are trying to submit the form before uploading the files. We suggest you refer to the below Syncfusion forum to know more information about the Edit form validation for the uploader component.


Forum Link : http://www.syncfusion.com/forums/170196/add-required-validation-option-to-file-upload-component?reply=SodByc


Kindly try the above suggestion and let us know if this meets your requirement. If we misunderstood the requirement, we request you to provide additional details about the requirement as mentioned below. This will help us validate the requirement further and provide you with a better solution.

  1. Exact Requirement details.
  2. Video illustration of the issue.


If this post is helpful, please consider Accepting it as the solution so that other members can locate it more quickly.


Regards,

Udhaya Kumar D


Marked as answer
Loader.
Up arrow icon