- In the Web. config file, the default upload limit is exceeded by 4 MB, as shown in figure
<Httpruntime
Executiontimeout = "110"
Maxrequestlength = "11000"
Requestlengthdiskthreshold = "80"
Usefullyqualifiedredirecturl = "false"
Minfreethreads = "8"
Minlocalrequestfreethreads = "4"
Apprequestqueuelimit = "5000"
Enablekerneloutputcache = "true"
Enableversionheader = "true"
Requirerootedsaveaspath = "true"
Enable = "true"
Shutdowntimeout = "90"
Delaynotificationtimeout = "5"
Waitchangenotification = "0"
Maxwaitchangenotification = "0"
Enableheaderchecking = "true"
Sendcachecontrolheader = "true"
Apartmentthreading = "false"/>
Set the maxrequestlenth attribute, Which is 11000kb, that is, 11 Mb.
For multi-file uploads, it is also very simple, suchString filepath = "d :\\ lucenedata \\";
Httpfilecollection uploadedfiles = request. files;
For (INT I = 0; I <uploadedfiles. Count; I ++)
{
Httppostedfile userpostedfile = uploadedfiles [I];
Try
{
If (userpostedfile. contentlength> 0)
{
Label1.text + = "<u> file #" + (I + 1) +
"</U> <br> ";
Label1.text + = "file content type:" +
Userpostedfile. contenttype + "<br> ";
Label1.text + = "file size:" +
Userpostedfile. contentlength + "kb <br> ";
Label1.text + = "file name:" +
Userpostedfile. filename + "<br> ";
Userpostedfile. saveas (filepath + "\" +
System. Io. Path. getfilename (userpostedfile. filename ));
Label1.text + = "location where saved:" +
Filepath + "\" +
System. Io. Path. getfilename (userpostedfile. filename) +
"<P> ";
}
}
Catch (exception ex)
{
Label1.text + = "error: <br>" + ex. message;
}
}
}