之前使用Uploadify做了一個上傳圖片並預覽的功能,今天在項目中,要使用該插件上傳大文件。之前弄過上傳圖片的demo,就使用該demo進行測試。可以查看我的這篇文章:[Asp.net]Uploadify所有配置說明,常見bug問題分析。
第一步:修改uploadify參數
1 'fileSizeLimit': '0',//單個文件大小,0為無限制,可接受KB,MB,GB等單位的字符串值
2 'fileTypeDesc': '文件',//文件描述Image Files
3 'fileTypeExts': '*.zip; *.rar; *.png',//允許上傳的文件類型
測試,用一個大於30M的文件,進行上傳測試。

第二步:修改web.config
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<!--maxRequestLength就是文件的最大字符數,最大值不能超過2個G左右,executionTimeout是超時時間-->
<httpRuntime targetFramework="4.5" maxRequestLength="1073741824" executionTimeout="3600" />
</system.web>
</configuration>
測試,仍使用上面的文件,進行上傳測試。

第三步:添加system.webServer節點
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<!--maxRequestLength就是文件的最大字符數,最大值不能超過2個G左右,executionTimeout是超時時間-->
<httpRuntime targetFramework="4.5" maxRequestLength="1073741824" executionTimeout="3600" />
</system.web>
<system.webServer>
<security>
<requestFiltering>
<!--修改服務器允許最大長度-->
<requestLimits maxAllowedContentLength="1073741824"/>
</requestFiltering>
</security>
</system.webServer>
</configuration>
測試,仍然用上面的文件,進行上傳測試:

