简体   繁体   English

Blazor 文件上传设置 pdf 大小

[英]Blazor file upload setting pdf size

I'm building a Blazor application with a pdf file uploader.我正在构建一个带有 pdf 文件上传器的 Blazor 应用程序。 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.目前它允许上传约 1.5 MB 并在 iframe 中显示。但是任何更大的文件(最多约 5 MB)和文件已上传但 iframe 无法呈现。

I've built it using the BlazorInputFile with some SQL quires to handle the CRUD operations of the file.我使用带有一些 SQL 请求的 BlazorInputFile 来构建它来处理文件的 CRUD 操作。

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?我的问题是,有没有办法设置/增加大小以上传更大的文件(大约 20MB)以及呈现它们以供查看?

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我假设这是一个服务器端 blazor 应用程序,这似乎是您会遇到的消息大小问题 - signalR 连接上消息的默认大小无法容纳如此大的文件,因此您可能需要增加它,有些东西像

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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