Click here to Skip to main content
15,887,881 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
method 1:
C#
Stream str_Kpme = file.PostedFile.InputStream;
  BinaryReader br_Kpme = new BinaryReader(str_Kpme);
byte[] Detail_fil = br_Kpme.ReadBytes((int)str_Kpme.Length);


Method2:
C#
byte[] Detail_fil = file.FileBytes;
Posted
Updated 29-Oct-14 5:48am
v2

1 solution

They both end up with the same result, but the first one allows you to read it in smaller chunks if you need to. The FileBytes property always returns a single array which holds the whole file. If for example the file exceeded the .NET 2GB limit on single objects, the second method would fail, where you could use the stream to access the large object in chunks.
 
Share this answer
 
Comments
[no name] 29-Oct-14 16:34pm    
My 5+

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900