Asp.net uploads a large file control

Source: Internet
Author: User

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 control (including progress bar)

The usage instructions are as follows:

<Summary>
Upload progress bar Control
</Summary>
<Example>
Web. config Configuration
<? XML version = "1.0"?>
<Configuration>
<Configsections>
<! -- Upload a node -->
<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>
<! -- Upload modules -->
<Httpmodules>
<Add name = "httpuploadmodule" type = "common. slickupload. httpuploadmodule, common"/>
</Httpmodules>
</System. Web>
<Deleetask>
<! -- Upload temporary path -->
<Add key = "uploadpath" value = "C: \ tddownload \ Temp"/>
<! -- Allow uploading pages. Separate multiple pages with ';' -->
<Add key = "httpuploadmodulepagegoon" value = "Upload. aspx;"/>
</Appsettings>
</Configuration>

ASPX page
// Top
<% @ Register Assembly = "common" namespace = "common. Web. appcontrol" tagprefix = "PC3" %>
// In form
<Asp: fileupload id = "fileuploadfile" runat = "server"/>
<Asp: button id = "btnupload" runat = "server" onclick = "button#click" text = "Upload"/>
<Asp: hyperlink id = "hycancel" runat = "server"> cancel </ASP: hyperlink>
<PC3: webuploadprogressbar id = "webuploadprogressbarcontrol" runat = "server" uploadpath = "C: \ tddownload"> </PC3: webuploadprogressbar>

CS corresponding to aspx Code
Protected void page_load (Object sender, eventargs E)
{
// Bind the upload client JavaScript event
This. btnupload. onclientclick = This. webuploadprogressbarcontrol. getuploadclick_javascript;
// Bind the upload cancel client JavaScript event
This. hycancel. navigateurl = "javascript:" + this. webuploadprogressbarcontrol. getuploadcancelclick_javascript;
}
Protected void btnupload_click (Object sender, eventargs E)
{
// Upload a file
This. webuploadprogressbarcontrol. saveuploadfiles ();
}
</Example>
<Remarks> you must set a port or virtual directory under the IIS Site to pass the test. If you have any questions, contact the zljGood@hotmail.com. </remarks>

contact the zljGood@hotmail.com if you have any questions, email: zlj9000@hotmail.com

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.