In this tutorial, I will show you How To Drag And Upload Multiple Image Files In ASP.NET. First, I create a blank ASP.NET WebForm Project. And then, right click on the Project ==>select NuGet Package Manager ==> Select DropZone and Download it.

Design a WebForm having a file upload control.
    <head runat="server"> 
        <title></title> 
        <script src="scripts/dropzone/dropzone.min.js"></script> 
        <link href="scripts/dropzone/basic.min.css" rel="stylesheet" /> 
        <link href="scripts/dropzone/dropzone.css" rel="stylesheet" /> 
          
        <script src="scripts/ai.0.15.0-build58334.min.js"></script> 
    </head> 
    <body> 
        <form id="form1" runat="server" class="dropzone"> 
            <div> 
                <div class="fallback"> 
                    <asp:FileUpload ID="file" runat="server" AllowMultiple="true" /> 
                </div> 
            </div> 
        </form> 
    </body> 
    </html> 


Write the following code in the code behind(.cs) file.
    protected void Page_Load(object sender, EventArgs e) 
           { 
               foreach (string s in Request.Files) 
               { 
                   HttpPostedFile file = Request.Files[s]; 
     
                   int fileSizeInBytes = file.ContentLength; 
                   string fileName = file.FileName; 
                   string fileExtension = ""; 
     
                   if (!string.IsNullOrEmpty(fileName)) 
                       fileExtension = Path.GetExtension(fileName); 
     
                   // IMPORTANT! Make sure to validate uploaded file contents, size, etc. to prevent scripts being uploaded into your web app directory 
                   // string savedFileName = Path.Combine(@"..\Files\", Guid.NewGuid().ToString() + fileExtension); 
                  string savepath = Path.Combine(Request.PhysicalApplicationPath, "Files"); 
                   string savefile = Path.Combine(savepath, file.FileName); 
                   file.SaveAs(savefile); 
               } 
           } 


Run the project and select multiple files and drag to the box.

Drag and drop all the images to the box. It will upload the images and save them to your local folder (here in Files Folder).

HostForLIFE.eu ASP.NET Core 1.1 Hosting

European best, cheap and reliable ASP.NET hosting with instant activation. HostForLIFE.eu is #1 Recommended Windows and ASP.NET hosting in European Continent. With 99.99% Uptime Guaranteed of Relibility, Stability and Performace. HostForLIFE.eu security team is constantly monitoring the entire network for unusual behaviour. We deliver hosting solution including Shared hosting, Cloud hosting, Reseller hosting, Dedicated Servers, and IT as Service for companies of all size.