Telerik FileSelect doesn't upload local files above a certain size threshold

1 Answer 242 Views
FileSelect
Ricardo
Top achievements
Rank 1
Iron
Ricardo asked on 24 Feb 2023, 10:07 AM | edited on 24 Feb 2023, 10:08 AM

Hello! I want to import .json files from my local machine using FileSelect:

<TelerikFileSelect AllowedExtensions = "@AllowedExtensions" MaxFileSize="@MaxFileSize" OnSelect = "@OnFileSelectHandlerTest"></TelerikFileSelect>

The maximum file size is set to 4MB and the OnSelect function is as defined below, which is pretty much the example given at Blazor FileSelect - Events - Telerik UI for Blazor:

    async Task OnFileSelectHandler(FileSelectEventArgs args)
    {
        foreach (var file in args.Files)
        {
            var byteArray = new byte[file.Size];
            await using MemoryStream ms = new MemoryStream(byteArray);
            await file.Stream.CopyToAsync(ms);
        }
    }

The method works fine for very small documents, below +- 26KB. Above this threshold, the app warns that it is attempting to reconnect to server and, after a couple of seconds, no document appears which suggests that the application gets stuck awaiting the CopyToAsync. The rest of the application (outside the FileSelect component) still works, but I can no longer add new files or remove the ones already selected. Has anyone been experiencing this problem and managed to solve it? (the same happens if I first create a local file and copy asynchronously into it)

Thank you

 

 

1 Answer, 1 is accepted

Sort by
1
Accepted
Dimo
Telerik team
answered on 28 Feb 2023, 12:05 PM

Hi Ricardo,

Our documentation discusses SignalR message size limitations. Adjust the app settings.

Regards,
Dimo
Progress Telerik

Learn about the important changes coming in UI for Blazor 4.0 in January 2023!
Tags
FileSelect
Asked by
Ricardo
Top achievements
Rank 1
Iron
Answers by
Dimo
Telerik team
Share this question
or