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.