Friday, February 11, 2011

Problem using the ASP.NET FileUpload control in an UpdatePanel?

I'm running into an issue where I have a FileUpload control in an UpdatePanel. When I attempt to save changes and upload the file, no file is found. If I remove the UpdatePanel everything seems to work fine.

Any ideas why this might be happening? And is there a work-around?

Screenshot

  • To upload a file you need to perform a full ASP.NET page postback, it does not operate over the partial postback method.

    You'll need to register the button which "uploads" your file as a PostBackTrigger of the UpdatePanel's triggers.

    There are lots of free (and non-free) AJAX file upload solutions, or you can easily create one, it's just a matter of putting your file upload control within an iframe and submitting the iframe page back to the server. It isn't really ajax, but it gives a visual impression of AJAX.

    Slace : Took me a bit the first time and I've had to show this to people I work with quite a few times
    mattruma : Do you have any links to alternative AJAX file upload solutions?
    Slace : http://geekswithblogs.net/rashid/archive/2007/08/01/Create-An-Ajax-Style-File-Upload.aspx is a link to making one yourself. be careful with UpdatePanels, they can be poor performers see: http://www.aaron-powell.com/blog.aspx?id=1195 and http://www.aaron-powell.com/blog.aspx?id=1209
    Tom : Also take a look at this for slow performance of an UpdatePanel http://blogs.msdn.com/tom/archive/2008/09/15/slow-performance-of-a-gridview-inside-an-updatepanel.aspx
    Slace : Yeah seen your post Tom, I'm a regular reader and have that particular post flagged for keeping ;) Only thing is your method doesn't get around the response size, which can still be very large
    From Slace

0 comments:

Post a Comment