以前使用Uploadify作了一個上傳圖片並預覽的功能,今天在項目中,要使用該插件上傳大文件。以前弄過上傳圖片的demo,就使用該demo進行測試。能夠查看個人這篇文章:[Asp.net]Uploadify全部配置說明,常見bug問題分析。html
第一步:修改uploadify參數web
1 'fileSizeLimit': '0',//單個文件大小,0爲無限制,可接受KB,MB,GB等單位的字符串值 2 'fileTypeDesc': '文件',//文件描述Image Files 3 'fileTypeExts': '*.zip; *.rar; *.png',//容許上傳的文件類型
測試,用一個大於30M的文件,進行上傳測試。服務器
第二步:修改web.configpost
1 <configuration> 2 <system.web> 3 <compilation debug="true" targetFramework="4.5" /> 4 <!--maxRequestLength就是文件的最大字符數,最大值不能超過2個G左右,executionTimeout是超時時間--> 5 <httpRuntime targetFramework="4.5" maxRequestLength="1073741824" executionTimeout="3600" /> 6 </system.web> 7 </configuration>
測試,仍使用上面的文件,進行上傳測試。測試
第三步:添加system.webServer節點url
1 <configuration> 2 <system.web> 3 <compilation debug="true" targetFramework="4.5" /> 4 <!--maxRequestLength就是文件的最大字符數,最大值不能超過2個G左右,executionTimeout是超時時間--> 5 <httpRuntime targetFramework="4.5" maxRequestLength="1073741824" executionTimeout="3600" /> 6 </system.web> 7 <system.webServer> 8 <security> 9 <requestFiltering> 10 <!--修改服務器容許最大長度--> 11 <requestLimits maxAllowedContentLength="1073741824"/> 12 </requestFiltering> 13 </security> 14 </system.webServer> 15 </configuration>
測試,仍然用上面的文件,進行上傳測試:spa
設置IIS.net
打開IIS管理器,找到Default Web Site。先進行中止。插件
在IIS中雙擊「請求篩選」打開。debug
點擊右邊的「編輯功能設置」,打開「編輯請求篩選設置」對話框。
其中的容許的最大容量長度,默認是」30000000「,30M,將其修改成1073741824,即1G。
啓動IIS.
在項目中遇到了這樣的問題,也花了點時間找解決方案,以爲既然花費了時間去找解決方案,就有必要總結一下,但願能幫到遇到一樣問題的你。 這裏再也不提供demo,以能夠從我上篇文章中下載,注意修改的地方已在本文章說明。