Tri Nguyen | November 01, 2011 | ADD COMMENT
Generally, all ASP.NET pages have a default FORM tag with POST method and default ACTION pointing to itself. It wraps around the content inside the BODY tag. Therefore, whenever a Postback occur, it's basically post to itself. Postback happens when user click on a button on the page or when they click on the browser "Refresh" button. In order to process file upload after user selecting a file, we'll need to create a postback after user selecting a file. This can be done by adding the " onchange='form.submit();' " to the file control. Basically, this will cause the form to submit, similar to a button click. The only difference is that we'll be process file selected file upload control during Page_Load(...) rather than inside a button click event.
View Our Demo