regular expression to check file content type is .doc or not?
- by Pandiya Chendur
When i use a file upload i use to check file contenttype with regular expressions... For ex
private bool IsImage(HttpPostedFile file)
{
if (file != null && Regex.IsMatch(file.ContentType, "image/\\S+") &&
file.ContentLength > 0)
{
return true;
}
return false;
}
This returns my file is an image or not... How to check it is a word(.doc/.docx) document or not using c#...