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
- <? XmlVersion="1.0"? >
- Configuration>
- <ConfigSections>
- <! -- Upload a node -->
- <SectionGroupName="SlickUpload">
- <SectionName="UploadLocationProvider" Type="Common. SlickUpload. Configuration. UploadLocationProviderHandler, Common"/>
- </SectionGroup>
- </ConfigSections>
- <System. web>
- <HttpRuntimeMaxRequestLength="2024000" ExecutionTimeout="300"/>
- <HttpHandlers>
- <AddVerb="*" Path="CommonToolsASHX. ashx" Type="Common. Web. AppControl. CommonToolsASHX, Common"/>
- <AddVerb="*" Path="CommonToolsASHX_XML.ashx" Type="Common. Web. AppControl. CommonToolsASHX_XML, Common"/>
- </HttpHandlers>
- <! -- Upload Modules -->
- <HttpModules>
- <AddName="HttpUploadModule" Type="Common. SlickUpload. HttpUploadModule, Common"/>
- </HttpModules>
- </System. web>
- <AppSettings>
- <! -- Upload temporary path -->
- <AddKey="UploadPath" Value="C: \ TDdownload \ temp"/>
- <! -- Allow uploading pages. Separate multiple pages with ';' -->
- <AddKey="HttpUploadModulePageGoOn" Value="Upload. aspx ;"/>
- </AppSettings>
- /Configuration>
ASPX page for ASP. NET File Upload Control
- // Top
- <%@ Register Assembly ="Common"Namespace ="Common. Web. AppControl"TagPrefix ="Maid"%>
- // 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"& Gt; </PC3: WebUploadProgressBar & gt;
CS code for ASPX of ASP. NET File Upload Control
- Protected VoidPage_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 VoidBTnUpload_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.
The example of the ASP. NET File Upload control will introduce you here, and hope to help you.
- Analysis on the types and features of ASP. NET Cache
- Three methods of ASP. NET page Jump
- Analysis on the nature and connection of iis asp. NET
- Analysis of iis asp. NET process mode
- ASP. NET program keeps two decimal points for parsing