[★] Multi-File Upload large File Settings

Source: Internet
Author: User

A few days ago, I downloaded a large file upload example on 51aspx .. I tried it .. it takes only 50 seconds for a 119 M object. I was still thinking about it. study hard. then write a normal upload example and compare it. just modified the configuration file. I tested 119 M and it was also 50 seconds .. only then can we find that this example is truly confusing...CodeTens of thousands of lines are written. How to set all. the upload status does not improve the upload efficiency...

Multi-File Upload
First, add the HTML component for file upload to the HTML source file.

<Script language = "JavaScript" type = "text/JavaScript">
Function AddFile ()
{
// Add an HTML component for File Upload
VaR STR = '<input type = "file" name = "file"/> </BR>'
Document. getelementbyid ('myfile'). insertadjacenthtml ("beforeend", STR)
}
</SCRIPT>
Background:
Httpfilecollection files = httpcontext. Current. Request. files;

For (INT ifile = 0; ifile <files. Count; ifile ++)
{
Httppostedfile postedfile = files [ifile];
String filename, fileextension;
Filename = system. Io. Path. getfilename (postedfile. filename );
If (filename! = "")
{
Fileextension = system. Io. Path. getextension (filename );
Postedfile. saveas (system. Web. httpcontext. Current. Request. mappath ("FLL/") + filename );
}
}
Response. Write ("the file is uploaded successfully! ");

When uploading large files, you need to modify the configuration file:

<Httpruntime usefullyqualifiedredirecturl = "true" maxrequestlength = "1024000" executiontimeout = "900"/>

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.