Quick post for those who may be suffering from a “Cannot Access A Closed File” exception when attempting to upload/save larger files with the AjaxControlToolkit AsyncFileUpload control…

Fix for me:

Add/edit an entry in your app’s web.config

<httpRuntime requestLengthDiskThreshold=”15360″ />

In my case this was caused by having a requestLengthDiskThreshold set too low, and was causing the file stream to close early.

8/29/2010 – *Update* Another issue you may be facing, is that your file size is exceeding the maxRequestLength setting.  To increase the size of this setting, you can define a web.config element like so (which will increase its size to approximately 2Gb allowed):

    <system.web> 
      <httpRuntime maxRequestLength="2097151" /> 
    </system.web>