简体   繁体   中英

Blazor file upload setting pdf size

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM