ASP.NET 4.5 brings many new desirable features to upgrade the functionality of previous versions.
Here I will discuss with you one of them, the feature of new the FileUpload control in ASP.NET 4.5. The FileUpload control in ASP.NET extends it's functionality by supporting the upload of multiple files at once.
Prior to this latest version, the FileUpload control only supported a single file at a time, but version ASP.NET version 4.5 solves this issue very well.
Now, the FileUpload control is built to support HTML 5, therefore it is only supported in browsers supporting HTML5. For other browsers it will work like a normal file upload control in ASP.NET.
A new attribute that comes with the ASP.NET 4.5 FileUplaod control is that,
AllowMultiple
It takes either true or false.
In order to support multiple file uploads, set AllowMulitple="true" other than false.
This attribute is for the browsers that support multiple files to be uploaded and for this purpose it renders the necessary HTML5 attribute.
In addition to this control, some new properties have been included to support code-behind coding.
HasFiles
Check whether FileUpload control has multiple files or not.
PostedFiles
Basically used to get all the files from the FileUpload control in the iteration.
Both properties will help to work with the mulitple selected files in Code-Behind coding (C#).
After the preceding overview of the theory, let's proceed to implement this cool feature in an application.
First, in the ASPX page declare a FileUpload control.
Remember: Set the AllowMultiple attribute to "true" to enable the multiple file upload feature.
- <asp:FileUpload runat="server" ID="UploadImages" AllowMultiple="true" />
- <input type="file" multiple="multiple" name="FileUpload1" id="FileUpload1" />




Marwa YoussefPosted May 6, 2021, 4:08 PM
What about the error ( foreach can't operate on a variables of type System.Web.HttpPostedFile doesn't contain a puplic definition for " GetEnumerator"
tank taeyangPosted May 14, 2020, 7:09 AM
If want to delete certain file?
sachin thorkarPosted Aug 14, 2018, 6:56 AM
Is it possible to show selected files before uploading?
Ratheesh PalaniPosted Jul 20, 2017, 6:28 AM
One error from the line uploadimages.postedFiles foreach(HttpPostedFile uploadedFile in UploadImages.PostedFiles) and the error is......System.Web.UI.WebControls.FileUpload' does not contain a definition for 'PostedFiles' and no extension method 'PostedFiles' accepting a first argument of type 'System.Web.UI.WebControls.FileUpload' could be found (are you missing a using directive or an assembly reference?
احمد البقرىPosted May 1, 2016, 1:27 AM
what about this problem Error 1 'System.Web.UI.WebControls.FileUpload' does not contain a definition for 'HasFiles' and no extension method 'HasFiles' accepting a first argument of type 'System.Web.UI.WebControls.FileUpload' could be found (are you missing a using directive or an assembly reference?)
Kev PatilPosted Dec 1, 2015, 9:44 AM
Is it possible to show selected files before uploading?
hothorasman panjaitanPosted Jan 24, 2015, 12:38 PM
how displays multi upload pdf files in a single row gridview
hothorasman panjaitanPosted Jan 22, 2015, 1:41 PM
how to bind gridview multiiupload one colomn in gridview
Rajeesh MenothPosted Jan 9, 2015, 11:29 PM
hai sir,how to delete those uploaded file individually??
Saber ShaikhPosted Sep 22, 2014, 7:24 AM
Very Use Full
neethuPosted Feb 11, 2014, 2:11 AM
How to do this in ASP.NET 3.5
ketan italiyaPosted Oct 23, 2013, 6:01 AM
thanks,sir
Vithal WadjePosted Apr 17, 2013, 3:32 PM
good one sir