title: Programmatically determine file types in SharePoint
body: <p>Is there a way to programmatically determine a file type in SharePoint? I want to limit the types of files that are being uploaded into a document library. I have written an EventReceiver that on ItemAdding conducts the following - </p>
  
  <p>if (!(properties.AfterUrl.Contains(".docx") || properties.AfterUrl.Contains(".pptx") || properties.AfterUrl.Contains(".xlsx") ))</p>
  
  <p>Surely there's a better way to do so?</p>