Web API code to Validate input File Format / Extension of Posted File

Below WebAPI code will  validate input file format or extension of posted file. Current code snippet validate file format for .txt and .csv, 
  1. public class CSVParserController : ApiController  
  2.     {  
  3.         //Web API method to take multiple files as input and Validate the file format / extension  
  4.         public JsonResult Post()  
  5.         {  
  6.             //Validation for file format  
  7.             for (int i = 0; i < System.Web.HttpContext.Current.Request.Files.Count; i++)  
  8.             {  
  9.                 System.Web.HttpPostedFile hpf = System.Web.HttpContext.Current.Request.Files[i];  
  10.                 if (hpf.ContentLength > 0)  
  11.                 {  
  12.                     if ((Path.GetExtension(hpf.FileName).ToLower() != ".txt") || (Path.GetExtension(hpf.FileName).ToLower() != ".csv") )  
  13.                     {  
  14.                         throw new ApplicationException("Error Occured-Invalid File Format. Please select only Txt and CSV format");  
  15.                     }  
  16.                 }  
  17.                       
  18.             }  
  19.         }  
  20.     }