What I'm trying to do is to create a form in asp.net - MVC which takes the input data from form and inserts it into the database. All the fields from the form are correctly taken from the form,except the image which always comes null.
I have tried to change the file in the model to have the type httppostedfilebase
,it did not worked. I also added enctype = multipart/form-data in the form and I added a name for the input file.All the other fields in the form are correctly send to action in controller,except for the image file.
This is the view code: https://pastebin.com/H1TrBV2x
This is the controller code : https://pastebin.com/0LPMcwJc
This is the model:
public class Product
{
public string Name { get; set; }
public int Price { get; set; }
public string Description { get; set; }
public string Category { get; set; }
public Image Picture { get; set; }
}