I have a list, ListPersonalDetails, for storing personal details of students. It has fields like firstName, lastname, address etc. It also contains a field to store the photo which is of type image. I created a visual webpart, StudentPersonalDetails, to add items to ListPersonalDetails. It contains a file upload control used to browse photo. I need to upload the image along with other details to the list. I am using Visual Studio 2010 for my SharePoint site development completely.
used the following code part to update the list:
SPListItem studentDetailsItem = SPContext.Current.Web.Lists["Student Details"].Items.Add(); studentDetailsItem["StudentID"] = Guid.NewGuid(); studentDetailsItem["FirstName"] = txtFirstName.Text; studentDetailsItem["LastName"] = txtLastName.Text; //studentDetailsItem["photo"]=need to upload photo studentDetailsItem.Update();
Any help on this is highly appreciated.