【www.gdgbn.com--班主任工作总结】

为了提供文件内容,我们需要首先需确定客户请求中发送的有文件内容,然后确定文件内容的位置。这部分对应的代码如下:

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        &

本文来源:http://www.gdgbn.com/banzhurengongzuo/14638/