why my fileupload control is not working fine
<p>I have a FileUpload control in my asp.net page that it should upload my picture in some folder on the host .I put a condition that when it has file ,it starts uploading.
this the code .</p>

<pre><code> if (File2.HasFile)
 {
      string b = File2.FileName.ToString();
      File2.PostedFile.SaveAs(path + File2.FileName);
 } 
</code></pre>

<p>but the condition never be true.I have two other FileUpload in that page .they are working fine .But this one is not working fine and the condition always is false.
what should I do?</p>

<p>this is the HTML code : </p>

<pre><code>&lt;asp:UpdatePanel ID="UpdatePanel3" runat="server"&gt;
                   &lt;ContentTemplate&gt;
                       &lt;table cellpadding="0" cellspacing="0" class="style4" dir="rtl" 
                           style="border: thin solid #008080"&gt;
                           &lt;tr&gt;
                               &lt;td&gt;
                                   &amp;nbsp;&lt;/td&gt;
                               &lt;td&gt;
                                   &amp;nbsp;&lt;/td&gt;
                           &lt;/tr&gt;
                           &lt;tr&gt;
                               &lt;td&gt;
                                   &lt;div style=" border-width: thin; border-color: #008080; border-left-style: solid;"&gt;
                                       &lt;asp:GridView ID="GridView2" runat="server" AllowPaging="True" 
                                           AutoGenerateColumns="False" CellPadding="4" DataSourceID="SqlDataSource4" 
                                           ForeColor="#333333" GridLines="None" onrowcommand="GridView2_RowCommand" 
                                           PageSize="6" Width="130px" Height="200px" ShowHeader="False"&gt;
                                           &lt;AlternatingRowStyle BackColor="White" /&gt;
                                           &lt;Columns&gt;
                                               &lt;asp:TemplateField&gt;
                                                   &lt;ItemTemplate&gt;
                                                       &lt;asp:LinkButton ID="LinkButton1" runat="server" 
                                                           CommandArgument='&lt;%#Eval("PID") %&gt;' CommandName="LnkEdit" 
                                                           Text='&lt;%#Eval("Pname") %&gt;'&gt;&lt;/asp:LinkButton&gt;
                                                   &lt;/ItemTemplate&gt;
                                               &lt;/asp:TemplateField&gt;
                                           &lt;/Columns&gt;
                                           &lt;EditRowStyle BackColor="#7C6F57" /&gt;
                                           &lt;FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" /&gt;
                                           &lt;HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" /&gt;
                                           &lt;PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" /&gt;
                                           &lt;RowStyle BackColor="#E3EAEB" /&gt;
                                           &lt;SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" /&gt;
                                           &lt;SortedAscendingCellStyle BackColor="#F8FAFA" /&gt;
                                           &lt;SortedAscendingHeaderStyle BackColor="#246B61" /&gt;
                                           &lt;SortedDescendingCellStyle BackColor="#D4DFE1" /&gt;
                                           &lt;SortedDescendingHeaderStyle BackColor="#15524A" /&gt;
                                       &lt;/asp:GridView&gt;
                                   &lt;/div&gt;
                                   &lt;asp:Label ID="Label18" runat="server"&gt;&lt;/asp:Label&gt;
                               &lt;/td&gt;
                               &lt;td&gt;
                                   &lt;div style="float  :right"&gt;
                                       &lt;table cellpadding="0" cellspacing="0" style="width: 500px"&gt;
                                           &lt;tr&gt;
                                               &lt;td&gt;
                                                   &lt;asp:Label ID="Label1" runat="server" Text="نام"&gt;&lt;/asp:Label&gt;
                                               &lt;/td&gt;
                                               &lt;td align="right"&gt;
                                                   &lt;asp:TextBox ID="TxTEditname" runat="server"&gt;&lt;/asp:TextBox&gt;
                                               &lt;/td&gt;
                                           &lt;/tr&gt;
                                           &lt;tr&gt;
                                               &lt;td&gt;
                                                   &lt;asp:Label ID="Label15" runat="server" Text="زبان"&gt;&lt;/asp:Label&gt;
                                               &lt;/td&gt;
                                               &lt;td align="right"&gt;
                                                   &lt;asp:DropDownList ID="DropDownList4" runat="server"&gt;
                                                       &lt;asp:ListItem Value="en"&gt;English&lt;/asp:ListItem&gt;
                                                       &lt;asp:ListItem Value="fa"&gt;فارسی&lt;/asp:ListItem&gt;
                                                   &lt;/asp:DropDownList&gt;
                                               &lt;/td&gt;
                                           &lt;/tr&gt;
                                           &lt;tr&gt;
                                               &lt;td&gt;
                                                   &lt;asp:Label ID="Label2" runat="server" Text="توضیحات"&gt;&lt;/asp:Label&gt;
                                               &lt;/td&gt;
                                               &lt;td align="right"&gt;
                                                   &lt;asp:TextBox ID="TxTEditdes" runat="server" Height="102px" 
                                                       TextMode="MultiLine" Width="380px"&gt;&lt;/asp:TextBox&gt;
                                               &lt;/td&gt;
                                           &lt;/tr&gt;
                                           &lt;tr&gt;
                                               &lt;td&gt;
                                                   &lt;asp:Label ID="Label19" runat="server" Text="عکس جدید"&gt;&lt;/asp:Label&gt;
                                               &lt;/td&gt;
                                               &lt;td align="right"&gt;
                                                   &lt;asp:FileUpload ID="File2" runat="server" /&gt;
                                               &lt;/td&gt;
                                           &lt;/tr&gt;
                                           &lt;tr&gt;
                                               &lt;td&gt;
                                                   &lt;asp:Button ID="Button1" runat="server" onclick="Button1_Click" 
                                                       Text="ثبت تغییرات" /&gt;
                                               &lt;/td&gt;
                                               &lt;td&gt;
                                                   &lt;asp:Label ID="Label17" runat="server"&gt;&lt;/asp:Label&gt;
                                               &lt;/td&gt;
                                           &lt;/tr&gt;
                                       &lt;/table&gt;
                                   &lt;/div&gt;
                               &lt;/td&gt;
                           &lt;/tr&gt;
                       &lt;/table&gt;
                   &lt;/ContentTemplate&gt;




               &lt;/asp:UpdatePanel&gt;
</code></pre>
