Uploading files works fine but now I\'m trying to validate file extensions and looks like there\'s some interference
between FileUpload1
and FileUpload2
are you uploading both files at the same time, or only one at a time? if it is only one at a time, then one of those values is always going to be false.
You are also adding a period in front of your validPhotoFile and validPDFFile, change your code like this.
for (int i = 0; i < validPhotoFile.Length; i++)
{
if (photoExt == validPhotoFile[i]) // remove the period here it is already in your variables above
{
isValidPhotoFile = true;
break;
}
}
for (int i = 0; i < validPDFFile.Length; i++)
{
if (pdfExt == validPDFFile[i]) // remove the period here it is already in your variables above
{
isValidPDFFile = true;
break;
}
}