asp.net super Large File Upload problem solving _ practical skills

Source: Internet
Author: User

Recently related to using ASP.net to do the upload function of a problem, because ASP.net has fileupload upload control, but this control upload file size is limited, so simply can not meet the demand
Baidu, a lot of people encounter asp.net upload oversized file confusion, the occasional search found csdn have a buddy mentioned this oversized file how to achieve, RadUpload.Net2.dll and provide this dynamic library for processing oversized file upload process. So downloaded down to see, really good effect, not only support noisy 700M file upload fast, more important is to support multiple-threaded upload files.
View source code found that the control used is also a fileupload control, but the processing of the process call is RadUpload.Net2.dll processing.
After uploading, the file is stored under the Upload folder under Bin, and the uploaded file can be renamed.

RadUpload.Net2.dll: Download Address


1. Create an ASPX page.
2. Create <asp:fileupload id= "FileUpload1" runat= "Server"/>.
3. Create <asp:button id= "Button3" runat= "server" text= "upload" onclick= "Button1_Click"/>
4. Upload code to call Net2.dll Dynamic Library processing process.
5. If you create multiple upload files, you can write a few more <asp:fileupload id= "FileUpload1" runat= "Server"/>.
6. Finally click the Upload button to perform the process.
The specific process is as follows

Copy Code code as follows:

foreach (uploadedfile file in RadUploadContext.Current.UploadedFiles)
{
String Path = Server.MapPath (@ "~/uploads");

If the path does not exist, create
if (System.IO.Directory.Exists (Path) = = False)
{
System.IO.Directory.CreateDirectory (Path);
}

               //combination path, file. GetName () gets the filename
                String oldfilename = file. GetName (). ToString ();

               //If the uploaded file is renamed , named after the GUID, release the following two 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;
}

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.