By using the below method we can check weather the selected file type is pdf or not.
we need to pass the ref id of the FileUpload control.
public static bool CheckValidPDFDOC(ref FileUpload file)
{
try
{
if (file.PostedFile.ContentType.ToLower() == "application/msword" || file.PostedFile.ContentType.ToLower() == "application/pdf")
{
return true;
}
else
{
return false;
}
}
catch
{
return false;
}
}
Thanks & Regards
Lakhan Pal Garg