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
viewswitch.SetActiveView(main)
End Sub
It errors on 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
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.
anthony_catl...
0 Points
2 Posts
System.NullReferenceException: Object reference not set to an instance of an object. Upload Immag...
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 viewswitch.SetActiveView(main) End SubIt errors on newimageid = ImageUtils.uploadImage(Title.Text, CInt(AlbumList2.SelectedValue), FileUpload1.FileContent)
please help this is driving me mad
News Items ClubSite Club Starter Kit CLUB Starter Kit 3.0 Events club kit ClubStartKit photo album event calendar NullReferenceException
vinz
All-Star
127087 Points
17946 Posts
MVP
Re: System.NullReferenceException: Object reference not set to an instance of an object. Upload I...
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.
MessageBox Controls for WebForms | Blog | Twitter | Linkedin
samatha.srir...
Member
110 Points
69 Posts
Re: System.NullReferenceException: Object reference not set to an instance of an object. Upload I...
Aug 19, 2010 04:34 AM|LINK
hi.........
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
anthony_catl...
0 Points
2 Posts
Re: System.NullReferenceException: Object reference not set to an instance of an object. Upload I...
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.
dheeraj.s.ku...
Member
6 Points
3 Posts
Re: System.NullReferenceException: Object reference not set to an instance of an object. Upload I...
Jun 30, 2012 12:05 PM|LINK
hi...i m having same problem in c#..
Objectnullreference exception occured in following code.....
please help......
byte[] videoBytes = new byte[100];
int fileLength7 = FileUpload2.PostedFile.ContentLength;
videoBytes = new byte[fileLength7];
FileUpload2.PostedFile.InputStream.Read(videoBytes, 0, fileLength7);