Uploading files works fine but now I\'m trying to validate file extensions and looks like there\'s some interference
between FileUpload1
and FileUpload2
bool CheckFileType(string fileName)
{
string ext = Path.GetExtension(fileName);
switch (ext.ToLower())
{
case ".gif":
return true;
case ".jpg":
return true;
case ".jpeg":
return true;
case ".png":
return true;
default:
return false;
}
}
if (CheckFileType(fuImage.FileName))
{
//..........
}
or use RegularExpressionValidator: