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;
- }
When I compile the procedure I get the following error message: "Object reference not set to an instance of an object."
Any idea how to fix the error?
Thank you in advance.