Simple processing of large file uploads in ASP. NET

Source: Internet
Author: User

In ASP. the built-in FileUpload control is often used for file upload during the development of. NET. However, it is widely known that this control has many limitations, the biggest problem is that it is especially troublesome for developers to upload large files, and it is difficult to conveniently perform multi-threaded operations and display the upload progress. The author recommends a simple and easy-to-use Upload Component to quickly and conveniently solve the problem of uploading large files in ASP. NET.

 

First, we need to download this component named RanUpLoad, you can go to my Baidu cloud disk download: http://pan.baidu.com/s/1ntuMpQT

 

After the download is complete, the two dll files are added to the reference area of the project. The xml files must also be copied to the bin folder in the project, that is, the last three files must be stored in the bin folder.

 

Next, the upload control still uses the self-contained FileUpload control in ASP. NET. You need to add a label next to the FileUpload control:

<radU:RadProgressManager ID= Width= runat= /><radU:RadProgressArea ID= Width= runat=></radU:RadProgressArea>

Add the following code at the beginning of the aspx file:

<%@ Register TagPrefix= Namespace= Assembly= %><%@ Register TagPrefix= Namespace= Assembly= %>

 

Of course, the following statements cannot be forgotten in the <system. web> tag of the configuration file:

 
    

 

Now, all the external outlines have been laid out, and the next step is to click the operations required by the server after uploading:

Of course, before doing this, we should first using the Telerik. WebControls namespace.

 (RadUploadContext.Current == ) {  (RadUploadContext.Current.UploadedFiles.Count <= .Page.ClientScript.RegisterStartupScript(.Page.GetType(), ,  (RadUploadContext.Current.UploadedFiles[].ContentLength >= .Page.ClientScript.RegisterStartupScript(.Page.GetType(), , = RadUploadContext.Current.UploadedFiles[ fileName = virtualPath = System.IO.Path.Combine( savePath = );  

 

Now, the file upload process has been completed. The above cs code is my own operations. You can modify it as needed, for example, you can place multiple FileUpload controls,

Use foreach (UploadedFile file in RadUploadContext. Current. UploadedFiles) {...} to process the upload of multiple files.

 

I hope this article will help friends who have a headache in uploading large files to easily solve the upload problem.

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.