Uploading files with asp.net FileUpload. Buffering to disk before filling up memory?
System.Web.UI.WebControls.FileUploa开发者_JAVA百科d uses a FileInputStream when uploading files. Does this store everything in memory when uploading or does it start writing to disk after a certain buffer size has been filled?
I know it used to work like that years ago, but I would think that has changed now... Can't find it in the docs though.
Some quick browsing through reflector seems to reveal that the FileUpload control makes use of an HttpInputStream instance.
Under the hood, HttpInputStream delegates work to an HttpRawUploadContent, which has a size threshold. Anything over that threshold gets pumped into a temporary file, anything below is handled entirely in memory.
精彩评论