Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jun 30, 2012 12:05 PM by dheeraj.s.kumar
Aug 17, 2010 11:50 AM|LINK
Hi i am getting the System.NullReferenceException: Object reference not set to an instance of an object. error when i try to upload an image can someone help? The site is going really well the only thing i can't seem to do is upload photo's.
Protected Sub UploadBtn_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim newimageid As Integer
newimageid = ImageUtils.uploadImage(Title.Text, CInt(AlbumList2.SelectedValue), FileUpload1.FileContent)
ImageId = newimageid
It errors on newimageid = ImageUtils.uploadImage(Title.Text, CInt(AlbumList2.SelectedValue), FileUpload1.FileContent)
please help this is driving me mad
Club Starter Kit
CLUB Starter Kit 3.0
Aug 18, 2010 05:55 AM|LINK
Hmm.. can you post your ASPX source here? I wan't to see how the control is declared on the page.
Aug 19, 2010 04:34 AM|LINK
u r not passing the file(image) which you uploaded.
<strong>newimageid = ImageUtils.uploadImage(Title.Text, CInt(AlbumList2.SelectedValue), FileUpload1.FileContent)
in this FileUpload1.FileContent is content of the file(image) which u uploaded but not the file.So,that u r geeting the error,try to pass file(image) insted of content like FileUpload1.PostedFile
Aug 19, 2010 07:41 PM|LINK
Solved the problem i had not changed the connectin string over in one of the classes so when i compiled the site things like the image handler would not work properly as i had the wrong connection string.
Jun 30, 2012 12:05 PM|LINK
hi...i m having same problem in c#..
Objectnullreference exception occured in following code.....
byte videoBytes = new byte;
int fileLength7 = FileUpload2.PostedFile.ContentLength;
videoBytes = new byte[fileLength7];
FileUpload2.PostedFile.InputStream.Read(videoBytes, 0, fileLength7);