Tuesday, December 20, 2011

Flex: Cannot upload larger files

I had a very strange problem with my file upload in flex. While it was working for smaller files, it threw weird errors for large files ( files greater than 30MB or so)

I got "Error #2038: File I/O Error." some times, and then "SecurityError: Error #2000: No active security context." error.

After some wild google chase, figured out that the problem was coming from IIS Server and Flex is not reporting the error correctly.


By default, IIS rejects files larger than 4MB or so, In order to fix this I used to add the following.

<system.web>
<httpRuntime maxRequestLength="102400" executionTimeout="600" />    <!-- 100mb ,10 min-->
</system.web>


but for IIS 6 or IIS 7, You also need a new section to allow large file uploads (100MB in my case)


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

and this fixed it.

No comments:

Post a Comment