Skip to main content
added 722 characters in body
Source Link
Joe Clinton
  • 145
  • 2
  • 12

You can do the Asynchronous Multiple File uploads using JavaScript or jQuery and that to without using any plugin. You can also show the real time progress of file upload in the progress control. I have come across 2 nice links -

  1. ASP.NET Web Forms based Mulitple File Upload Feature with Progress Bar
  2. ASP.NET MVC based Multiple File Upload made in jQuery

The server side language is C# but you can do some modification for making it work with other language like PHP.

File Upload ASP.NET Core MVC:

In the View create file upload control in html:

<form method="post" asp-action="Add" enctype="multipart/form-data">
    <input type="file" multiple name="mediaUpload" />
    <button type="submit">Submit</button>
</form>

Now create action method in your controller:

[HttpPost]
public async Task<IActionResult> Add(IFormFile[] mediaUpload)
{
    //looping through all the files
    foreach (IFormFile file in mediaUpload)
    {
        //saving the files
        string path = Path.Combine(hostingEnvironment.WebRootPath, "some-folder-path"); 
        using (var stream = new FileStream(path, FileMode.Create))
        {
            await file.CopyToAsync(stream);
        }
    }
}

hostingEnvironment variable is of type IHostingEnvironment which can be injected to the controller using dependency injection, like:

private IHostingEnvironment hostingEnvironment;
public MediaController(IHostingEnvironment environment)
{
    hostingEnvironment = environment;
}

You can do the Asynchronous Multiple File uploads using JavaScript or jQuery and that to without using any plugin. You can also show the real time progress of file upload in the progress control. I have come across 2 nice links -

  1. ASP.NET Web Forms based Mulitple File Upload Feature with Progress Bar
  2. ASP.NET MVC based Multiple File Upload made in jQuery

The server side language is C# but you can do some modification for making it work with other language like PHP.

You can do the Asynchronous Multiple File uploads using JavaScript or jQuery and that to without using any plugin. You can also show the real time progress of file upload in the progress control. I have come across 2 nice links -

  1. ASP.NET Web Forms based Mulitple File Upload Feature with Progress Bar
  2. ASP.NET MVC based Multiple File Upload made in jQuery

The server side language is C# but you can do some modification for making it work with other language like PHP.

File Upload ASP.NET Core MVC:

In the View create file upload control in html:

<form method="post" asp-action="Add" enctype="multipart/form-data">
    <input type="file" multiple name="mediaUpload" />
    <button type="submit">Submit</button>
</form>

Now create action method in your controller:

[HttpPost]
public async Task<IActionResult> Add(IFormFile[] mediaUpload)
{
    //looping through all the files
    foreach (IFormFile file in mediaUpload)
    {
        //saving the files
        string path = Path.Combine(hostingEnvironment.WebRootPath, "some-folder-path"); 
        using (var stream = new FileStream(path, FileMode.Create))
        {
            await file.CopyToAsync(stream);
        }
    }
}

hostingEnvironment variable is of type IHostingEnvironment which can be injected to the controller using dependency injection, like:

private IHostingEnvironment hostingEnvironment;
public MediaController(IHostingEnvironment environment)
{
    hostingEnvironment = environment;
}
Source Link
Joe Clinton
  • 145
  • 2
  • 12

You can do the Asynchronous Multiple File uploads using JavaScript or jQuery and that to without using any plugin. You can also show the real time progress of file upload in the progress control. I have come across 2 nice links -

  1. ASP.NET Web Forms based Mulitple File Upload Feature with Progress Bar
  2. ASP.NET MVC based Multiple File Upload made in jQuery

The server side language is C# but you can do some modification for making it work with other language like PHP.