Been banging my head against the wall and Google try to find the answer to my problem.
When the below IF statement executes is appears to be running completely through the IF and ELSE statements.
if (IsPostBack)
{
Boolean bFileOK = false;
if (fulReagentImg.HasFile)
{
String sFileExtension = System.IO.Path.GetExtension(fulReagentImg.FileName).ToLower();
String sFileExtensionLabel = sFileExtension;
lblFileExtension.Text = sFileExtensionLabel;
String[] allowedExtensions = { ".gif", ".png", ".jpeg", ".jpg" };
for (int i = 0; i < allowedExtensions.Length; i++)
{
if (sFileExtension == allowedExtensions[i])
{
bFileOK = true;
}
else
{
lblException.Text = "Can only upload .gif, .png, .jpeg, .jpg";
lblException.CssClass = "red";
}
}
Any ideas why it's not stopping with bFileOK = true?