We have been using the below jQuery plugin to help us.
jQuery Multiple File Upload Plugin
After including the necessary js file : jQuery.multifile.pack.js, we can use it like below.
<input type="file" id="flAttachment" runat="server" tabindex="8" class="multi max-3 accept-gif|jpg|xlsx|xls|doc|docx|pdf|png" size="37" />
Giving class="multi" makes it to accept more than one file.
You can also apply the constraints if you want. Like class = "max-3" would allow maximum three files to be uploaded. class = "accept-gif|jpg" would only allow files with gif OR jpg extensions to be uploaded.
For getting the multiple files on the sever side you will need to include the namespace : System.Web;
Then you can have the below code for iterating through each file uploaded.
if (Request.Files.Count > 0)
{
HttpFileCollection attachments = Request.Files;
for (int i = 0; i < attachments.Count; i++)
{
HttpPostedFile attachment = attachments[i];
if (attachment.ContentLength > 0 && !String.IsNullOrEmpty(attachment.FileName))
{
//do your file saving or any related tasks here.
}
}
}
This would be regardless of .net framework version.