user327999
user327999

Reputation: 453

JQuery Ajax File Upload Fail on Large Files

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

Upvotes: 3

Views: 6453

Answers (1)

Darin Dimitrov
Darin Dimitrov

Reputation: 1038770

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>

Upvotes: 11

Related Questions