大文件上傳控件(包含進度條)
使用說明如下:
<summary>
上傳進度條控件
</summary>
<example>
Web.config 配置
<?xml version="1.0"?>
<configuration>
<configSections>
<!--上傳節點-->
<sectionGroup name="slickUpload">
<section name="uploadLocationProvider" type="Common.SlickUpload.Configuration.UploadLocationProviderHandler, Common"/>
</sectionGroup>
</configSections>
<system.web>
<httpRuntime maxRequestLength="2024000" executionTimeout="300"/>
<httpHandlers>
<add verb="*" path="CommonToolsASHX.ashx" type="Common.Web.AppControl.CommonToolsASHX, Common" />
<add verb="*" path="CommonToolsASHX_XML.ashx" type="Common.Web.AppControl.CommonToolsASHX_XML, Common" />
</httpHandlers>
<!--上傳Modules-->
<httpModules>
<add name="HttpUploadModule" type="Common.SlickUpload.HttpUploadModule, Common"/>
</httpModules>
</system.web>
<appSettings>
<!--上傳臨時路徑-->
<add key="uploadPath" value="c:TDdownloadtemp"/>
<!--許可上傳頁面,多個頁面用';'分開-->
<add key="HttpUploadModulePageGoOn" value="Upload.aspx;"/>
</appSettings>
</configuration>
ASPX頁面
//頂部
<%@ Register Assembly="Common" Namespace="Common.Web.AppControl" TagPrefix="cc1" %>
//form內
<asp:FileUpload ID="fileUploadFile" runat="server" />
<asp:Button ID="BtnUpload" runat="server" OnClick="Button1_Click" Text="Upload" />
<asp:HyperLink ID="hyCancel" runat="server">Cancel</asp:HyperLink>
<cc1:WebUploadProgressBar ID="WebUploadProgressBarControl" runat="server" UploadPath="C:TDdownload"></cc1:WebUploadProgressBar>
ASPX對應的CS代碼
protected void Page_Load(object sender, EventArgs e)
{
//綁定上傳客戶端javascript事件
this.BtnUpload.OnClientClick = this.WebUploadProgressBarControl.GetUploadClick_Javascript;
//綁定上傳取消客戶端javascript事件
this.hyCancel.NavigateUrl = "javascript:" + this.WebUploadProgressBarControl.GetUploadCancelClick_Javascript;
}
protected void BtnUpload_Click(object sender, EventArgs e)
{
//上傳文件
this.WebUploadProgressBarControl.SaveUploadFiles();
}
</example>
<remarks>必須在IIS站點下設置端口或虛擬目錄方可測試通過,又問題請和
[email protected]聯系</remarks>