我目前有一个 ASP.Net MVC Web 应用程序,需要使用 ajax 上传大文件。我目前正在使用这个 jQuery 插件 - http://valums.com/ajax-upload/ .我也用过这个插件 - http://jquery.malsup.com但得到相同的结果。
我对大文件的问题是,为了异步请求而生成的 iframe 没有及时加载。
它似乎总是指向这段代码:var doc = iframe.contentDocument ? iframe.contentDocument : iframe.contentWindow.document, response;
对于较小的文件,脚本运行良好,但对于较大的文件,iframe 似乎从未正确初始化。
这让我发疯了。有人可以帮忙吗?
提前致谢
最佳答案
您可能需要使用 <httpRuntime>
增加服务器上允许的最大请求大小以及请求的执行超时时间。 web.config 中的部分
<system.web>
<httpRuntime
maxRequestLength="size in kbytes"
executionTimeout="seconds"
/>
...
</system.web>
如果您在 IIS 7.0+ 中部署您的应用程序,您可能还需要使用
<requestLimits>
增加允许的最大请求大小。 <system.webServer>
的节点部分:<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="size in bytes" />
</requestFiltering>
</security>
...
</system.webServer>
关于ajax - JQuery Ajax 文件上传大文件失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9281933/