即使在DropZone中将maxFilesize设置为500,也无法加载文件大小超过20MB的文件

时间:2018-06-05 07:05:28

标签: javascript c# html

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大小的文件,错误为&#34;超出最大请求长度&#34;在C#和Request.Files.Count中显示0计数。请帮帮我。谢谢。

1 个答案:

答案 0 :(得分:1)

允许上传最大大小为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>