Then I checked the Form property of Request object, the file upload control was missing in the AllKeys collection
We all know that if you want file uploads the form encode must be multipart/form-data. This is the reason why File Upload is not working properly inside Update Panel, lets understand this with following example.
Problem:
File upload is not working with update panel + asp.net
You are having two controls which needs to get display after one-another or post-back, first control does not have File upload and Second control does. Things to notice here is form tag will be reside either in ASPX page or Master page not in UserControl; and our File Upload is inside user control. Now when we load first control which does not have File Upload so the form will not encoded with multipart/form-data, now when you load second control which has the File Upload hence fort encode must be multipart/form-data, which is unfortunately not changing due to Update Panel.
Solution:
In problem definition we come to know that form must be encoded with multipart/form-data if we want to upload the file; solution is very simple, we just need to change encoded attribute of form with following single line!!!
</ASP:UPDATEPANEL>We all know that if you want file uploads the form encode must be multipart/form-data. This is the reason why File Upload is not working properly inside Update Panel, lets understand this with following example.
Problem:
File upload is not working with update panel + asp.net
You are having two controls which needs to get display after one-another or post-back, first control does not have File upload and Second control does. Things to notice here is form tag will be reside either in ASPX page or Master page not in UserControl; and our File Upload is inside user control. Now when we load first control which does not have File Upload so the form will not encoded with multipart/form-data, now when you load second control which has the File Upload hence fort encode must be multipart/form-data, which is unfortunately not changing due to Update Panel.
Solution:
In problem definition we come to know that form must be encoded with multipart/form-data if we want to upload the file; solution is very simple, we just need to change encoded attribute of form with following single line!!!
Page.Form.Attributes.Add("enctype", "multipart/form-data");
THis is also working Fine.