why don't u check the type of file while uploading by extacting its extension :
check the sample :
if (FileUpload1.PostedFile.ContentType.ToUpper().IndexOf("IMAGE") > -1)
{
System.Drawing.Image img = System.Drawing.Image.FromStream(FileUpload1.PostedFile.InputStream);
int Width = img.Width;
int Height = img.Height;
if (Width > 1000 || Height > 1000 || FileUpload1.PostedFile.ContentLength > 1024 * 1024 * 200)
{
this.ClientScript.RegisterStartupScript(this.GetType(), "Startup",
"<script language='javascript'>alert('The image size is too large!');</script>");
}
else
{
if (type == "jpg" || type == "gif" || type == "bmp" || type == "JPG" || type == "GIF")
{
string ImagePath = "images/";
string sPath = Server.MapPath(ImagePath) + dataName + fileName;
string imgPath = ImagePath + dataName + fileName;
this.FileUpload1.PostedFile.SaveAs(sPath);
this.ClientScript.RegisterStartupScript(this.GetType(),
"Startup", "<script language='javascript'>alert('Success!');</script>");
this.Image1.ImageUrl = imgPath;
this.btnSubmit.Enabled = false;
this.btnSubmit.Text = "Success!";
this.btnSubmit.Enabled = true;
}
else
{
this.ClientScript.RegisterStartupScript(this.GetType(), "Startup",
"<script language='javascript'>alert('File type is not right!');</script>");
}
}
}