title: UploadFile1.PostedFile.FileName is giving null exception error. How to handle this?
body: <p>I am developing a website, in which i have to upload excel file. I have a form which is placed inside an UpdatePanel. When i use this code:</p>
  
  <pre><code>protected void uploadClick(object sender, EventArgs e)
  {
  
     string extension = Path.GetExtension(Uploader.PostedFile.FileName);
  
  }
  </code></pre>
  
  <p>From the above line..I am checking the extension of the file. If it would be other than .xlsx , i will prompt user that such type of file is not allowed. But the problem is that</p>
  
  <p>Uploader.PostedFile.Name is  giving null error exeception.  This is error message:</p>
  
  <p>NullReferenceException was unhandled by user code</p>
  
  <p>Kindly help me how to handle this situation. Regards</p>