Asp.net implements the upload of large file control instances

Source: Internet
Author: User

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: TDdownloademp"/>
<! -- Allow uploading pages. Multiple pages are used; Separate -->
<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 code corresponding to ASPX
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.

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.