Asp.net generally processes the problem that the program receives the uploaded files. asp.net uploads files.
When Html + ashx is used to process file uploads, the problem that the file to be uploaded exceeds 4 MB occurs. The first HTML code is as follows:
<! DOCTYPE html> View Code
The general processing program UpLoadHandler. ashx code is as follows:
Using System; using System. collections. generic; using System. IO; using System. linq; using System. web; namespace Zhong. summary of Web {// <summary> /// UpLoadHandler // </summary> public class UpLoadHandler: IHttpHandler {public void ProcessRequest (HttpContext context) {context. response. contentType = "text/plain"; // obtain all uploaded files // if the size of the uploaded file exceeds 4 MB, an exception [exceeds the maximum request length.], In the Web. config: Configure HttpFileCollection. request. files; // if it is a private key. if the value of Count is 0, the request is directly sent to the ashx handler for (int I = 0; I View Code
When uploading a file larger than 4 MB, the exception is as follows:
You can modify the file upload size limit by configuring web. config.
<? Xml version = "1.0" encoding = "UTF-8"?> <! -- For more information about how to configure ASP. NET applications, visit the http://go.microsoft.com/fwlink? LinkId = 169433 --> <configuration> <system. web> <! -- The unit of maxRequestLength is kb. The maximum length cannot exceed 2097151 Kb, that is, 4 GB. The executionTimeout operation times out, the Unit is seconds -->
A line is added here