1HttpApplication app = sender as HttpApplication; 2 HttpWorkerRequest request = GetWorkerRequest(app.Context); 3 4 if (!IsUploadRequest(app.Request)) return; //不是文件上传,则退出 5 6 string sContentType = app.Request.ContentType.ToLower(); 7 byte[] arrBoundary = GetMultipartBoundary(sContentType); 8 int ContentLength = app.Request.ContentLength; //信息体的总长度 9 10 DataReader dataReader = new DataReader(app.Context.Request.ContentEncoding, arrBoundary); 11 DateTime startDate = DateTime.Now; 12 byte[] arrBuffer = request.GetPreloadedEntityBody(); 13 if (arrBuffer == null) 14 { 15 arrBuffer = new Byte[0]; 16 tempFile.Close(); 17 return; //没有读取到信息体 18 } 19 else 20 { 21 这里是对文件内容的处理 22 }
|