在igUpload中上传大文件的文件失败

时间:2016-12-27 09:11:27

标签: javascript file-upload infragistics ignite-ui

我正在使用Infragistics的igUpload上传多个文件。当文件大小小于3 MB时,一切正常,但当我尝试上传大小较大的文件时,它会失败并返回此错误

  

无法获取您当前的文件状态!可能连接丢失了

我还将 uploadUtilsBufferSize 更改为10485760但仍然无法用于更大的文件。以下是igUplaod的配置

Button.igUpload({
    mode: 'multiple',
    multipleFiles: true,
    AutoStartUpload: false,
    progressUrl: "IGUploadStatusHandler.ashx",
    controlId: "upload1",
    labelUploadButton: "Upload",
    onError: function(evt, ui) {
        if (ui.errorType == "serverside") {
            ErrorMessage.append("<p>" + ui.serverMessage + "</p>");
        } else if (ui.errorType == "clientside") {
            ErrorMessage.append("<p>" + ui.errorMessage + "</p>");
        }
    }
});

2 个答案:

答案 0 :(得分:4)

IIS Web服务器上存在最大请求长度限制。对于IIS 6,它是4 MB(详细信息here)。对于IIS 7和更新版本是28.6 MB(详细信息here)。

根据您使用的IIS版本,请尝试使用web.config中的以下设置:

IIS 6(web.config):

<system.web>
    <httpHandlers>
         <add verb="GET" type="Infragistics.Web.Mvc.UploadStatusHandler" 
                         path="IGUploadStatusHandler.ashx" />
    </httpHandlers>
    <httpModules>
        <add name="IGUploadModule" type="Infragistics.Web.Mvc.UploadModule" />
    </httpModules>
    <!--OPTIONAL: Set the maximum request length.
    By default the request lenght is 4 MB.
    More info: http://msdn.microsoft.com/en-us/library/e1f13641(v=vs.85).aspx-->
    <httpRuntime executionTimeout="3600" maxRequestLength="2097151000"/>
</system.web>

IIS 7(及更高版本)(web.config):

<system.webServer>
    <modules runAllManagedModulesForAllRequests="true">
        <add name="IGUploadModule" type="Infragistics.Web.Mvc.UploadModule" 
                                   preCondition="managedHandler" />
    </modules>
    <handlers>
        <add name="IGUploadStatusHandler" path="IGUploadStatusHandler.ashx" verb="*"
            type="Infragistics.Web.Mvc.UploadStatusHandler" preCondition="integratedMode" />
   </handlers>    
   <security>      
        <requestFiltering>    
            <!--OPTIONAL: Set the maximum request length.
            By default the request lenght is ~30 MB.
            More info: http://www.iis.net/configreference/system.webserver/security/requestfiltering/requestlimits-->
            <requestLimits maxAllowedContentLength="2097151000"/>
      </requestFiltering>    
   </security>
</system.webServer>

P.S。:此信息记录在Ignite UI帮助here中。

答案 1 :(得分:1)

当我尝试上载到的目录没有足够的权限来配置IIS用户时,我也收到此消息。在我的情况下,授予IIS_IUSR对文件夹的写权限解决了我的问题。

相关问题