Thursday 13 January 2022

Multiple file upload by form post ASP.NET C# MVC


Multiple file upload by form post ASP.NET C# MVC


This post will let you upload multiple image files through a single form post using the C# ASP.Net MVC platform.

Key Point

  • Upload multiple image files with a new name
  • Save a associate record and file name will be newly created record identity field value
  • No need to save the image name in the database because the file name will start with a record ID and end with a text. 
  • Best for putting student, employee documents without any hassle. 

HTML Code : 

<form method="post" enctype="multipart/form-data">

     @Html.AntiForgeryToken()

    <p class="m-0">

        Photo

        <input type="file" name="Photo" id="Photo" accept="image/x-png,image/jpeg" />

        <br />

        Adhaar

        <input type="file" name="Adhaar" id="Adhaar" accept="image/x-png,image/jpeg" />

        <br />

        Pan

        <input type="file" name="Pan" id="Pan" accept="image/x-png,image/jpeg" />

        <br />

        <input type="checkbox" id="chkconfirm" /> I provide my consent. I will follow the Tangentweb term condition and policy.

        <br /> <br />

        <input type="submit" value="Save" class="button button-primary button-wide-mobile" onclick="return filecheck()" />

    </p> 

</form>