This tutorial will show how to implement the FileUpload control so that files can be uploaded to a website. C# version.

In this tutorial, we will create both a single file upload form and a multi-file upload form.
After adding one FileUpload control for the single file upload and three for the multi-file upload, we two buttons to submit each form. We also add a GridView control to display the files which have been uploaded. Note the DataSource of this GridView.

The ASPX code looks something like this:

The DataSource of the GridView is a function that collects the file list of the uploads folder, hence listing all the files in that folder in the GridView control.
Both of the Submit buttons run the same function — UploadThisFile(). The only difference being, the multi-file upload button calls the function three times, each time with the different names of three FileUpload controls. And once the functions have been called, the new data is bound to the GridView, displaying the newly-uploaded files.
The code behind would look something like this:

Download Source Files