Asp.Net MVC大文件使用XMLHTTPRequest上传

时间:2015-12-11 00:20:03

标签: asp.net-mvc-4 xmlhttprequest

我使用XMLHttpRequest将多个上传到ASP.NET MVC控制器。我将多个文件附加到FormData并将它们发送到一个XMLHttpRequest中,并且我使用IISExpress。 通过谷歌搜索,我已将web.config更改为:

<httpRuntime targetFramework="4.5" maxRequestLength="2147483647" executionTimeout="3600" requestLengthDiskThreshold="2147483647"/>

<system.webServer>
    <security>
      <requestFiltering>
        <requestLimits maxAllowedContentLength="2147483647" />
      </requestFiltering>
    </security>
</system.webServer>

<system.web.extensions>
    <scripting>
      <webServices>
        <jsonSerialization maxJsonLength="2147483644"></jsonSerialization>
      </webServices>
    </scripting>
</system.web.extensions>

我也尝试使用&#34; PUT&#34;而不是&#34; POST&#34;打开XMLHttpRequest如下:

 xhr.open("PUT", myForm.action, true);

但我仍然无法提出超过30 MB的请求!我真的需要做这项工作,所以我希望有人能尽快帮助我。

1 个答案:

答案 0 :(得分:0)

尝试删除异步&#39; true&#39;来自xhr.open函数