Microsoft had enhanced the file upload control and introduced a new feature of multi-fileUpload. This feature is really awesome and saves hours of work which most of programmers were doing in creation of custom/user control for the same.
This new feature was introduced to make the programmers life easier with HTML5 support. Your HTML document is now by default in HTML5.
If you set "AllowedMultiple" property of FileUpload control to true, it enables the control to hold multiple files.
In this post, we are just going to have a look at this control with the help of a sample demo application.
Steps:
1. Add a FileUpload control on the aspx page and set the AllowMultiple property to true.

2. Add a Button control to upload the files on the server.

3. Write code at code-behind cs file where we will (i) Iterate through each file which our FileUpload control holds and (ii) save these files onto the target location/folder.
- protected void uploadFile_Click(object sender, EventArgs e)
- {
- if (multipleFile.HasFiles)
- {
- string filenameWithPath = string.Empty;
- foreach (HttpPostedFile uploadedFile in multipleFile.PostedFiles)
- {
- filenameWithPath = System.IO.Path.Combine(Server.MapPath("~/Uploads/"),uploadedFile.FileName);
- uploadedFile.SaveAs( filenameWithPath );
- ltStatusText.Text += "File-<b>" + uploadedFile.FileName + "</b> uploaded successfully.<br>";
- }
- }
- }

Just for the safer side, first check that if UploadControl has any files or not. This is just double check as you may have written some JavaScript to validate it client-side.
That'it! Now run the application.

Let's select 3-4 files.

After selecting files, click Open button.

Now, we are all ready to put these files onto the server, so let's click on the Send Files button.

Great! It has uploaded our files on the server. Let's check it in the Windows Explorer if they are really there!

Cheers!!

priya goelPosted Jul 27, 2017, 7:56 AM
How to downlad this code
Anil KumarPosted Oct 22, 2015, 1:09 AM
Thank you all for your nice words!
Saineshwar BageriPosted Sep 20, 2015, 1:06 AM
nice one
Santhakumar MunuswamyPosted Sep 17, 2015, 10:33 AM
Thanks for nice article:)
Vinodh NarayananPosted Sep 14, 2015, 11:31 PM
good one
Pankaj Kumar ChoudharyPosted Sep 14, 2015, 9:42 PM
Nice Show........
Shridhar SharmaPosted Sep 14, 2015, 2:15 PM
nice demo :)
Mohammed IbrahimPosted Sep 14, 2015, 1:07 PM
nice information
Rajeesh MenothPosted Sep 14, 2015, 11:53 AM
Good One..
Raja TPosted Sep 14, 2015, 7:42 AM
Good One Sir, Thanks for sharing
Harshad PansuriyaPosted Sep 14, 2015, 7:39 AM
Nice One Sir