Pages

Saturday, 18 February 2012

ASP.NET code for Uploading the file content into a stream object

               One nice feature of the FileUpload control is that it not only gives you the capability to save the file to disk,but it also lets you place the contents file into a Stream object.You do this by using the FileContent property as ;

VB
Dim myStream As System.IO.Stream
myStream = FileUpload1.FileContent

C#
System.IO.Stream myStream ;
myStream = FileUpload1.FileContent ;

                 In thios short example,an instance of the Stream object is created.Then,using the FileUpload control's FileContent property,the content of the uploaded file is placed into the object.This is possible because the FileContent  property returns a Stream object.

No comments:

Post a Comment