First, we need to download the component named Ranupload.
After the download is complete, two DLL files are added to the project's reference Central, and the XML files are copied to the Bin folder in the project, which means that the last three files are in the Bin folder.
Next, the upload control or the FileUpload control that comes with asp.net, what you need to add is a label next to the FileUpload control:
<radu:radprogressmanager id= "Radprogressmanager1" width= "100%" runat= "server"/> <radu
: Radprogressarea id= "progressArea1" width= "100%" runat= "Server" >
</radU:RadProgressArea>
and add the following code at the beginning of the ASPX file:
<%@ Register tagprefix= "Telerik" namespace= "Telerik.quickstart" assembly= "Telerik.quickstart"%> <%@
Register tagprefix= "RadU" namespace= "Telerik.webcontrols" assembly= "Radupload.net2"%>
Of course, the following statements cannot be forgotten in the <system.web> tab of the configuration file:
Now that the external contours have been made, the next step is to click on the server-side action after the upload:
Of course, before doing these things, let's start with the Telerik.webcontrols namespace.
Check file
if (raduploadcontext.current = null) {return;}
if (RadUploadContext.Current.UploadedFiles.Count <= 0)
{this
. Page.ClientScript.RegisterStartupScript (this. Page.gettype (), "MsgBox", "<script>alert (' please choose to upload file! ') </script> ");
return;
}
if (raduploadcontext.current.uploadedfiles[0). ContentLength >= 2147483647)
{this
. Page.ClientScript.RegisterStartupScript (this. Page.gettype (), "MsgBox", "<script>alert (' uploaded files must not exceed 2GB!"). ') </script> ");
return;
}
UploadedFile file = raduploadcontext.current.uploadedfiles[0];
String fileName = Path.getfilename (file. FileName);
String virtualpath = System.IO.Path.Combine ("~/save", fileName);
String Savepath = this. MapPath (virtualpath);
File. SaveAs (Savepath, true);
At this point, the file upload processing work has been completed, the above CS code is my own some of the operation of processing, you can modify their own circumstances, as appropriate, such as also can place multiple FileUpload control,
With foreach (UploadedFile file in RadUploadContext.Current.UploadedFiles) {...} This way to handle multiple file uploads.
Hopefully this article will help friends with big file uploads headaches to easily handle uploading problems.