javascript - 即使在 DropZone 中将 maxFilesize 设置为 500,也无法加载文件大小超过 20MB 的文件
问题描述
for (int i = 0; i < Request.Files.Count; i++)
{
HttpPostedFileBase file = Request.Files[i];
//Save file content goes here
fName = file.FileName;
if (file != null && file.ContentLength > 0)
{
}}
以上是我获取文件并保存到自定义路径的 C# 代码。
Dropzone.options.dropzoneForm = {
autoProcessQueue: false,
uploadMultiple: true,
parallelUploads: 100,
maxFiles: 100,
maxFilesize: 500,
acceptedFiles: 'image/jpeg,image/png,image/tiff,application/pdf,.pdf,.jpeg,.jpg,.tiff,.tif,.pdf',
init: function () {}}
以上是我的 dropzone 的 java 脚本代码。在这里,我将 maxFilesize 指定为 500MB,我正在尝试上传 22MB 大小的文件,在 C# 中出现“超出最大请求长度”的错误,并且 Request.Files.Count 显示为 0 计数。请帮助我。在此先感谢。
解决方案
它允许上传最大大小为 2GB 的文件。在 web.config 文件中更新此设置
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" maxRequestLength="2147483" executionTimeout="1600" requestLengthDiskThreshold="2147483647" />
</system.web>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="2147483647" />
</requestFiltering>
</security>
</system.webServer>
推荐阅读
- sql - 使用 Case 语句转换查询
- c++ - 为什么函数中用作返回值的类实例在函数返回时不调用其析构函数?
- maven - 使用本地依赖和远程
- ios - 使用 AVAudioPlayerNode 播放片段时,我可以注册两个不同的回调,调度完成和播放完成吗?
- c# - 如何读取CSV并将其一一放入DataGrid视图C#
- php - 如何从我的第一页复制这个隐藏的值并在我的第二页发布?
- android - setAudioRoute (int routes) 有哪些不同的 (int routes) 值?
- javascript - 为什么当触发合成事件时,与之相关的事件不会发生?
- vb.net - vb.net Datagrid 值到另一个数据网格
- react-native - 处理 android 上 react-native firebase phone auth 的自动检索