1
Answer

file upload control in updatepanel is not working correctly

Photo of Lahiru Kalutotage

Lahiru Kalutotage

Sep 03
427
1

I added a file upload inside an UpdatePanel using the following code:

<asp:UpdatePanel ID="pnlUpdateMain" runat="server">
    <ContentTemplate>

        <%-- File upload + other codes here -->

    </ContentTemplate>
</asp:UpdatePanel>
 

• When I try to get the selected file name using:

if (fuLoanConfirmation.HasFile)
{
    string fileName = fuLoanConfirmation.PostedFile.FileName.ToString();
}

 

fuLoanConfirmation.HasFile always returns false.

I also set triggers for the UpdatePanel, but it still didn't work.

When I removed the UpdatePanel, it worked, but I need the UpdatePanel to be included.

Answers (1)

2
Photo of Rajeesh Menoth
66 27.1k 2.7m Sep 03

Hi,

I don’t see any upload button in your ASPX file. If you are using PostBackTrigger, it will trigger the information. Refer to the following Stack Overflow reference for more details.

https://stackoverflow.com/questions/9682737/fileupload-hasfile-is-always-false