I was running into an issue when I put File Upload control in Update Panel to use nice feature of AJAX. When It was doing postback everytime I was getting PostedFile property of FileUpload control to NULL. I was wondering why that was happening because that page was very simple not any complex code I wrote in there.
But there is a known issue that FileUpload control doesn’t work inside AJAX update panel. As always there should be some workaround for that. You need to do full page post back in order to upload file. We can’t use AJAX postback to upload file.
You can do full page post back using one of following solution.
1) You can add postbacktrigger for the button that causes a post back to upload file.
<asp:updatepanel runat=”server” id=”UpdatePanel1″>
<asp:FileUpload runat=”server” id=”FileUpload” />
<asp:button runat=”server” id=”Upload” text=”Postback” />
<asp:postbacktrigger controlid=”Upload” />
2) Another way to cause full page post back in code behind.
Updated: 3) if you are using .NET 3.5 or higher version, you can use latest version of AJAX Control Toolkit that has a AsyncFileUpload control that works perfectly fine.
Hope this helps you!!!