add this line to validate
null
value
for (int i = 0; i < fileUpload.Count(); i++)
{
if (List[i] != null)
{
if (list[i].ContentLength > 0 && i == 0)
{
HttpPostedFileBase file = files[i];
LogoImage = Path.GetFileName(partnersVM.listPartnerVM.PartnerName + "_" + list[i].FileName);
var path = Path.Combine(Server.MapPath("~/UploadedImages/PremiUserRegistration/LogoImage/"), LogoImage);
file.SaveAs(path);
}
else if (list[i].ContentLength > 0 && i == 1)
{
HttpPostedFileBase file = files[i];
TitlePictureImage = Path.GetFileName(partnersVM.listPartnerVM.PartnerName + "_" + list[i].FileName);
var path = Path.Combine(Server.MapPath("~/UploadedImages/PremiUserRegistration/TitlePicture/"), TitlePictureImage);
file.SaveAs(path);
}
else if (list[i].ContentLength > 0 && i == 2)
{
HttpPostedFileBase file = files[i];
TitlePictureImage = Path.GetFileName(partnersVM.listPartnerVM.PartnerName + "_" + list[i].FileName);
var path = Path.Combine(Server.MapPath("~/UploadedImages/PremiUserRegistration/Brochure/"), TitlePictureImage);
file.SaveAs(path);
}
}
}