10 TIPs - To Become a Good Developer/Programmer
Why Join
Become a member
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
C# Corner Home
Technologies
Monthly Leaders
ASK A QUESTION
Forum guidelines
Dealy
0
216
0
Object reference not set to an instance of an object (byte[]
Aug 2 2016 1:36 AM
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.
Reply
Answers (
8
)
Set properties via a file
Barcode Label Generation and Printing