Hi there,
I'm struggling a bit to make it so that if a user does not upload a picture and it will be given the default image.
Here is the code:
protected void Add_Click(object sender, EventArgs e)
{
int userId = (int)Session["LoggedIn"];
using(mainDBDataContext dbconnect = new mainDBDataContext())
{
Article newArticle = new Article
{
Title = TitleTextBox.Text,
Description = DescriptionTextBox.Text,
Category = CategoryTextBox.Text,
ImageSrc = ImageFileUpload.FileName,
UserId = userId
};
if(ImageFileUpload.HasFile)
{
String path = getPath("~/Images");
String filename = ImageFileUpload.FileName;
try
{
...
Go to the complete details ...