title: File Upload Control is not working
body: <p>File name and extension are empty. Please help.</p>
  
  <p><strong>ASPX FILE CODE:</strong></p>
  
  <pre><code>&lt;tr&gt;
    &lt;td colspan="3" style="height:0px"&gt;
      &lt;div id="trFile" runat="server" class="inlineGridAddAddress"&gt;
        &lt;table cellpadding="0" cellspacing="0"&gt;
          &lt;tr&gt;
            &lt;td&gt;
              &lt;div class="formFieldName"&gt;
                &lt;asp:RequiredFieldValidator ID="reqFile" runat="server"
                    ControlToValidate="fileUpload" ErrorMessage="Please select File"
                    ValidationGroup="Save" CssClass="Validations" &gt;&lt;/asp:RequiredFieldValidator&gt;
              &lt;/div&gt;
            &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
            &lt;td&gt;
              &lt;asp:Label ID="lblFile" runat="server"&gt;File:&lt;/asp:Label&gt;
            &lt;/td&gt;
            &lt;td&gt;
              &lt;div&gt;
                &lt;asp:FileUpload ID="fileUpload" runat="server" /&gt;
              &lt;/div&gt;
            &lt;/td&gt;
            &lt;td class="tdformFieldValueLogin" style="width:350px;padding-left:50px"&gt;
              &lt;asp:ImageButton ID="btnFileUploadSave" runat="server" ValidationGroup="Save"
                  ImageUrl="~/App_Themes/Default/images/update.png" ToolTip="Save"
                  Height="18px" onclick="btnFileUploadSave_Click"/&gt;
              &lt;asp:ImageButton ID="btnFileUploadCancel" ImageUrl="~/App_Themes/Default/images/cancel.png"
                  runat="server" ToolTip="Cancel" Height="18px" /&gt;
            &lt;/td&gt;
          &lt;/tr&gt;
  
          &lt;tr&gt;
            &lt;td&gt;
              &lt;div class="formSmallTextAreaName"&gt;
                &lt;asp:Label ID="lblDescription" runat="server"&gt;Description:&lt;/asp:Label&gt;
              &lt;/div&gt;
            &lt;/td&gt;
            &lt;td&gt;
              &lt;div class="formSmallTextAreaValue"&gt;
                &lt;asp:RegularExpressionValidator ID="revNote"
                    runat="server" ControlToValidate="txtDescription"
                    ValidationExpression="^[\s\S]{0,4096}$"
                    Text="Maximum 4096 characters are allowed."
                    CssClass="Validations" Display="Dynamic"&gt;
                &lt;/asp:RegularExpressionValidator&gt;
                &lt;asp:TextBox ID="txtDescription"
                    runat="server" CssClass="textEntry1"
                    TextMode="MultiLine" MaxLength="4096" Width="218px"&gt;
                &lt;/asp:TextBox&gt;
              &lt;/div&gt;
            &lt;/td&gt;
          &lt;/tr&gt;
        &lt;/table&gt;
      &lt;/div&gt;
    &lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p><strong>CS FILE CODE:</strong></p>
  
  <pre><code>protected void btnFileUploadSave_Click(object sender, ImageClickEventArgs e)
      {
          string path = Server.MapPath(".") + "\\Files\\" + this.fileUpload.FileName;
          string fileExtension = System.IO.Path.GetExtension(this.fileUpload.FileName).ToLower();
          if (fileExtension == ".txt" || fileExtension == ".doc" || fileExtension == ".docx" || fileExtension == ".zip" || fileExtension == ".rar" || fileExtension == ".cs" || fileExtension == ".ppt" || fileExtension == ".pdf" || fileExtension == ".html" || fileExtension == ".jpg" || fileExtension == ".gif" || fileExtension == ".bmp" || fileExtension == ".png" || fileExtension == ".tif" || fileExtension == ".rm" || fileExtension == ".mp3" || fileExtension == ".xls")
          {
              this.fileUpload.PostedFile.SaveAs(path);
          }
      }
  </code></pre>