Blazor file upload setting pdf size

841 views Asked by At

I'm building a Blazor application with a pdf file uploader. Currently it allows for about 1.5 MB to be uploaded and displayed in an iframe. However anything larger (up to about 5 MB) and the file is uploaded but the iframe fails to render.

I've built it using the BlazorInputFile with some SQL quires to handle the CRUD operations of the file.

My question, is there a way to set/increase the size to upload larger files (of about 20MB) as well as rendering them to be viewed?

Any help or advice will be appreciated.

1

There are 1 answers

0
rdmptn On

I am assuming this is a server-side blazor app, it seems like an issue you would hit with messages sizes - the default size for a message on the signalR connection can't accommodate such large files so you may need to increase it, something like

services.AddServerSideBlazor().AddHubOptions(o =>
{
    o.MaximumReceiveMessageSize = 4 * 1024 * 1024; // 4MB
});