Multiple image uploads is possible in ASP.NET, using C#. There are some simple steps to understand. How to upload multiple image file by single file upload control?
Step 1

Now, create a new ASP.NET Web Application.

Step 2

Write the code, given below, on default.aspx page.
  1. <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UploadMultipleFileDemo.aspx.cs"
  2. Inherits="MultipleFile.UploadMultipleFileDemo" %> < !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  3. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
  4. < html xmlns = "http://www.w3.org/1999/xhtml" >
  5. < head runat = "server" >
  6. < title > < /title> < /head> < body >
  7. < form id = "form1"
  8. runat = "server" >
  9. < div >
  10. < asp: ScriptManager ID = "SM"
  11. runat = "server" >
  12. < /asp:ScriptManager>
  13. < asp: UpdatePanel ID = "UpdFileUpload"
  14. runat = "server" >
  15. < ContentTemplate >
  16. < asp: FileUpload ID = "FuImage"
  17. multiple = "multiple"
  18. runat = "server" / >
  19. < asp: Button ID = "btnSaveFile"
  20. Text = "Save"
  21. runat = "server"
  22. onclick = "btnSaveFile_Click" / >
  23. < /ContentTemplate> < Triggers >
  24. < asp: PostBackTrigger ControlID = "btnSaveFile" / > -
  25. < /Triggers> < /asp:UpdatePanel> < /div> < /form> < /body> < /html>
Step-3
Now, add the useful and relevant namespace, given below-
  1. using System;
  2. using System.Web;
  3. using System.IO;
Step-4
Now, add the line of the code, given below, on default.aspx.cs page-
  1. namespace MultipleFile {
  2. public partial class UploadMultipleFileDemo: System.Web.UI.Page {
  3. protected void Page_Load(object sender, EventArgs e) {
  4. }
  5. protected void btnSaveFile_Click(object sender, EventArgs e) {
  6. HttpFileCollection _HttpFileCollection = Request.Files;
  7. for (int i = 0; i < _HttpFileCollection.Count; i++) {
  8. HttpPostedFile _HttpPostedFile = _HttpFileCollection[i];
  9. if (_HttpPostedFile.ContentLength > 0)
  10. _HttpPostedFile.SaveAs(Server.MapPath("~/a4d/ComposeEmail/" + Path.GetFileName(_HttpPostedFile.FileName)));
  11. }
  12. }
  13. }
  14. }
Step-5
Now, run your Application and you will get the output, given below-
Step-6
Now, click browse and select one or more than one image.
Step-7
Now, click save button after selecting all the image file.
Step-8
Now, you can see in our client folder, where all the selected images are saved.