Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
8
Reply
Object reference not set to an instance of an object (byte[]
Dealy
Aug 2 2016 1:36 AM
455
Reply
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.
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
8
)
Next Recommended Forum
Set properties via a file
Barcode Label Generation and Printing