I have a fileupload in my page so the user can browse the computer and select the file. After selecting the file when I want to get the name of file using this code:
string ext = System.IO.Path.GetExtension(FileUpload1.PostedFile.FileName);
It returns null and I got this error :
Object reference not set to an instance of an object.
After debugging I found that my file is posted null and it doesn't send. Why? After adding a little code I got this error :
<asp:UpdatePanel runat="server" ID="UpdatePanel1" UpdateMode="Always">
        <ContentTemplate>
<div class="wrapper-box">
                                <div class="topbox">
                                    عکس خبر
                                </div>
                                 <asp:FileUpload ID="FileUpload1" runat="server" CssClass="text-input-two" />
                            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
 
     
     
     
     
    