private void FinishFileData(HttpRequest request) { if (uploaded_file == null) return; // Chop off the \r\n that gets appended before the boundary marker uploaded_file.Contents.SetLength (uploaded_file.Contents.Position - 2); uploaded_file.Contents.Position = 0; //uploaded_file.Finish (); if (uploaded_file.Length > 0) request.Files.Add (current_name, uploaded_file); uploaded_file = null; }
public void ParseContentDisposition(string str) { current_name = GetContentDispositionAttribute (str, "name"); current_filename = GetContentDispositionAttributeWithEncoding (str, "filename"); if (!String.IsNullOrEmpty (current_filename)) { // XXX: use temp file for larger uploads uploaded_file = new UploadedFile() { Name = current_filename, ContentType = content_type, Contents = new MemoryStream(), }; } }