Examples of ASP. NET File Upload controls

Source: Internet
Author: User

How to Implement the ASP. NET File Upload control?

During this time, I wrote an ASP. NET upload large file control. After testing, the progress bar is displayed in IE. I would like to share with you more comments.

Large File Upload controls include progress bars)

The usage instructions are as follows:
<Summary>
Upload progress bar Control
</Summary>
<Example>
Web. config configuration of ASP. NET File Upload Control

 
 
  1. <? XmlVersion="1.0"? >
  2. Configuration>
  3. <ConfigSections>
  4. <! -- Upload a node -->
  5. <SectionGroupName="SlickUpload">
  6. <SectionName="UploadLocationProvider" Type="Common. SlickUpload. Configuration. UploadLocationProviderHandler, Common"/>
  7. </SectionGroup>
  8. </ConfigSections>
  9. <System. web>
  10. <HttpRuntimeMaxRequestLength="2024000" ExecutionTimeout="300"/>
  11. <HttpHandlers>
  12. <AddVerb="*" Path="CommonToolsASHX. ashx" Type="Common. Web. AppControl. CommonToolsASHX, Common"/>
  13. <AddVerb="*" Path="CommonToolsASHX_XML.ashx" Type="Common. Web. AppControl. CommonToolsASHX_XML, Common"/>
  14. </HttpHandlers>
  15. <! -- Upload Modules -->
  16. <HttpModules>
  17. <AddName="HttpUploadModule" Type="Common. SlickUpload. HttpUploadModule, Common"/>
  18. </HttpModules>
  19. </System. web>
  20. <AppSettings>
  21. <! -- Upload temporary path -->
  22. <AddKey="UploadPath" Value="C: \ TDdownload \ temp"/>
  23. <! -- Allow uploading pages. Separate multiple pages with ';' -->
  24. <AddKey="HttpUploadModulePageGoOn" Value="Upload. aspx ;"/>
  25. </AppSettings>
  26. /Configuration>

ASPX page for ASP. NET File Upload Control

 
 
  1. // Top 
  2. <%@ Register Assembly ="Common"Namespace ="Common. Web. AppControl"TagPrefix ="Maid"%>
  3.  // In form 
  4. <Asp: FileUpload ID ="FileUploadFile"Runat ="Server"/>
  5. <Asp: Button ID ="BTnUpload"Runat ="Server"OnClick ="Button#click"Text ="Upload"/>
  6. <Asp: HyperLink ID ="HyCancel"Runat ="Server"> Cancel </asp: HyperLink>
  7. <PC3: WebUploadProgressBar ID ="WebUploadProgressBarControl"Runat ="Server"UploadPath ="C: \ TDdownload"& Gt; </PC3: WebUploadProgressBar & gt;

CS code for ASPX of ASP. NET File Upload Control

 
 
  1. Protected VoidPage_Load (object sender, EventArgs e)
  2. {
  3. // Bind the upload client javascript event 
  4. This. BTnUpload. OnClientClick =This. WebUploadProgressBarControl. GetUploadClick_Javascript;
  5. // Bind the upload cancel client javascript event 
  6. This. HyCancel. NavigateUrl ="Javascript :"+This. WebUploadProgressBarControl. GetUploadCancelClick_Javascript;
  7. }
  8. Protected VoidBTnUpload_Click (object sender, EventArgs e)
  9. {
  10. // Upload a file 
  11. This. WebUploadProgressBarControl. SaveUploadFiles ();
  12. }
  13. </Example>
  14. <Remarks>

You must set a port or virtual directory under the IIS Site to pass the test.

The example of the ASP. NET File Upload control will introduce you here, and hope to help you.

  1. Analysis on the types and features of ASP. NET Cache
  2. Three methods of ASP. NET page Jump
  3. Analysis on the nature and connection of iis asp. NET
  4. Analysis of iis asp. NET process mode
  5. ASP. NET program keeps two decimal points for parsing

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.