Asp.Net large file upload problem resolved

  • 2020-06-07 04:25:13
  • OfStack

Recently, there was a problem with using for uploading because has fileupload's upload control, but the file size of this control is limited, so it doesn't meet the requirements at all
On Baidu, many people encounter the confusion of uploading super-large files from Occasionally, a friend of csdn mentioned how to realize this super-large file, RadUpload.Net2.dll and provided this dynamic library to handle the uploading process of super-large files. So I downloaded down to see, as expected the effect is good, not only support noisy 700M file upload fast, more important is to support multi-threaded upload file.
Looking at the source code reveals that the control being utilized is also an fileupload control, but the processing procedure is called by RadUpload.Net2.dll.
The uploaded files are stored in the upload folder under bin, and the uploaded files can be renamed.

RadUpload.Net2.dll: Download address

1. Create 1 aspx page.
2. To create < asp:FileUpload ID="FileUpload1" runat="server" / > .
3. Create a < asp:Button ID="Button3" runat="server" Text=" upload "OnClick="Button1_Click" / >
4. Dynamic library processing process of calling net2.dll in the upload code.
5. If you create multiple uploads, write more than one < asp:FileUpload ID="FileUpload1" runat="server" / > .
6. Finally, click the upload button to execute the process.
The process is as follows

 foreach (UploadedFile file in RadUploadContext.Current.UploadedFiles)
                string Path = Server.MapPath(@"~/Uploads");
                // If the path does not exist, it is created 
                if (System.IO.Directory.Exists(Path) == false)
                // The combined path, file.GetName() Get file name 
                string oldfilename = file.GetName().ToString();
                // If the uploaded file is renamed according to guid To name, let go below 2 Lines of code 
                //string fileType = oldfilename.Substring(oldfilename.LastIndexOf("."));
                //string newfilename = Guid.NewGuid().ToString("N") + fileType;
                //Path = Path + "/" + file.GetName().ToString();
                Path = Path + "/" + oldfilename;
                // save 
                file.SaveAs(Path, true);
                string newurl = @"~/Uploads/" + oldfilename;              

Related articles: