In this post we will see a small example to understand the file upload control in Asp.net. For this take a fileupload control, button controls and a label on form default.aspx, code given below.

And then add a new folder “uploads” to your website. The C# code in the code behind file is like this:


In the above code you can see Server.MapPath, here we are saving the uploaded file in uploads folder in our asp.net website.

You can see the image below to understand output,Here it is a screen shot when a ms word 2007 file is uploaded.

fileupload-control-asp-net

Download Source Code