JQuery Ajax File Upload Fail on Large Files

北城以北 提交于 2021-02-06 06:27:20

问题


I currently have a ASP.Net MVC web application that needs to upload large files using ajax. I am currently using this jQuery plugin - http://valums.com/ajax-upload/. I have also used this plugin - http://jquery.malsup.com but get the same result.

The issue that I am having for large file is that the iframe that gets generated to in order for the request to be asynchronous is not loading in time.

It always seems to point to this code:

var doc = iframe.contentDocument ? iframe.contentDocument : iframe.contentWindow.document, response; 

For smaller files the script works great but for larger files the iframe nevers seems to get initialized properly.

This has been driving me crazy. Can someone please HELP.

thanks in advance


回答1:


You might need to increase the maximum allowed request size on the server as well as the execution timeout of the request using the <httpRuntime> section in your web.config

<system.web>
    <httpRuntime 
        maxRequestLength="size in kbytes"
        executionTimeout="seconds"
    />

    ...
</system.web>

And if you are deploying your application in IIS 7.0+ you might also need to increase the maximum allowed request size using the <requestLimits> node of the <system.webServer> section:

<system.webServer>
    <security>
        <requestFiltering>
            <requestLimits maxAllowedContentLength="size in bytes" />
        </requestFiltering>
    </security>

    ...
</system.webServer>


来源:https://stackoverflow.com/questions/9281933/jquery-ajax-file-upload-fail-on-large-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!