This "issue" is not related to Web forms at all. It is only related to the HTML use for uploading: you can use
<input type="file"/>
; and it has to be in some Web form, with "Sumbit" button (
type="submit"
; for basic information, please see:
http://www.w3schools.com/html/html_forms.asp).
This is a minimal solution, one one of the most practically reasonable at the same time:
<img src="myUploadedImage.png"/>
Now, follow this simple logic: by all counts, you already have server-side processing and handle uploads. If you wanted to avoid saving a file in your server-side file system, it could be a bit more complex, but you don't want it, you want to save the file. If you wanted to do some post-processing of file before presentation, it could be a bit more complex, but apparently you are not doing anything like that. But then you don't need to read anything from HTTP request and do any processing except saving the file under certain file name and referencing this file name in the
<img>
element of your HTML generated in your HTTP response, no matter how you do it.
There are a lot of articles written on handling uploads. Let's consider one ASP.NET example: you can use the class
System.Web.UI.WebControls.FileUpload
:
https://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.fileupload%28v=vs.110%29.aspx,
and, for example,
http://asp.net-tutorials.com/controls/file-upload-control.
Pay attention form the
SaveAs
call in the code sample references above. This is all you need, no stream reading, no other processing; everything is already done by ASP.NET.
If you use something else, the idea will be exactly the same.
—SA