To provide the file content, we need to first determine the file content sent in the customer request, and then determine the location of the file content. The code for this part is as follows:
1 HttpApplication app = sender as HttpApplication; 2 HttpWorkerRequest request = GetWorkerRequest (app. Context ); 3 4 if (! IsUploadRequest (app. Request) return; // exit if the file is not uploaded. 5 6 string sContentType = app. Request. ContentType. ToLower (); 7 byte [] arrBoundary = GetMultipartBoundary (sContentType ); 8 int ContentLength = app. Request. ContentLength; // The total length of the information body 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; // No information body is read 18} 19 else 20 &
|
<