Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How should I parse Request.GetBufferlessInputStream()

I'm working on an upload control for ASP.NET, and I need to work with Request.GetBufferlessInputStream()

This returns the raw unprocessed request stream. Is there a built in way to parse the content of this stream, stripping out headers such as the example I've copied below.

If not what is the best approach to parsing the file?

-----------------------------13166267887793
Content-Disposition: form-data; name="uploadFile"; filename="ABigFile.txt"
Content-Type: text/plain
like image 967
gb2d Avatar asked Dec 07 '25 09:12

gb2d


1 Answers

The solution came from inspecting how it's done in System.Web, and adapting to my needs. The core functionality is found in an internal class called HttpMultipartContentTemplateParser. The system for processing the input stream is written up here:

http://blog.appsoftware.com/2014/03/aspnet-file-uploader-with-signalr.html

like image 122
gb2d Avatar answered Dec 10 '25 00:12

gb2d



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!