Hello,
I have the following code:
- public byte[] getFile(FileUpload file)
- {
- byte[] bytes=null;
- using (Stream fs = file.PostedFile.InputStream)
- {
- using (BinaryReader br = new BinaryReader(fs))
- {
- bytes = br.ReadBytes((Int32)fs.Length);
- }
- }
- return bytes;
- }
Any idea how to fix the error?
Thank you in advance.

Joginder BangerRank #360 · 7K reputationPosted Aug 1, 2016, 9:49 PM EDT
DealyRank #9,518 · 205 reputationPosted Aug 1, 2016, 10:01 PM EDT
Rajeev PunhaniRank #551 · 4.4K reputationPosted Aug 1, 2016, 10:20 PM EDT
Hi Dealy,
Please tryinitializingand tell where exactly you are getting error.Bikesh SrivastavaRank #108 · 20.3K reputationPosted Aug 1, 2016, 10:20 PM EDT
Joginder BangerRank #360 · 7K reputationPosted Aug 1, 2016, 10:22 PM EDT
Manas MohapatraRank #182 · 13.2K reputationPosted Aug 1, 2016, 10:35 PM EDT
DealyRank #9,518 · 205 reputationPosted Aug 1, 2016, 11:06 PM EDT
Bhushan GawaleRank #299 · 8.4K reputationPosted Aug 1, 2016, 11:15 PM EDT