asp.net 大檔案上傳控制項

來源:互聯網
上載者:User

大檔案上傳控制項(包含進度條)
  使用說明如下:
   <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網站下設定連接埠或虛擬目錄方可測試通過,又問題請和zljGood@hotmail.com聯絡</remarks>
相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.