hi,
i am trying to do passing multiple upload file to controller. but i am not getting the Exact answer can you please help me for this.
- <form name='frmAccount' id='frmAccount'>
- <input type='file' name='file1'/>
- <input type='file' name='file2'/>
- <input type='file' name='file3'/>
- <input type='file' name='file4'/>
- <input type='file' name='file5'/>
- <input type='file' name='file6'/>
- <input type='file' name='file7'/>
- <input type='submit' name='submit' />
- form>
- public class ImageModel
- {
- public HttpPostedFileBase file1{get;set;}
- public HttpPostedFileBase file2{get;set;}
- public HttpPostedFileBase file3{get;set;}
- public HttpPostedFileBase file4{get;set;}
- public HttpPostedFileBase file5{get;set;}
- public HttpPostedFileBase file6{get;set;}
- public HttpPostedFileBase file7{get;set;}
- }
- var formData = new FormData($('#frmAccount')[0]);
- $.ajax({
- url: "@Url.Action("AddCustomer", "Example")",
- type: "POST",
- data: formData ,
- dataType: 'json',
- contentType: false,
- processData: false,
- success: function (data) {
- }
- },
- error: function (xhr, desc, err) {
- }
- });
- [HttpPost]
- public ActionResult AddCustomer(ImageModel model)
- {
- //i want to get all the files Here.
- }

Manav PandyaRank #166 · 14.3K reputationPosted Apr 11, 2018, 1:37 AM EDT
Manav PandyaRank #166 · 14.3K reputationPosted Apr 11, 2018, 1:09 AM EDT
mari muthuRank #8,962 · 213 reputationPosted Apr 11, 2018, 1:19 AM EDT
Manav PandyaRank #166 · 14.3K reputationPosted Apr 11, 2018, 1:22 AM EDT
mari muthuRank #8,962 · 213 reputationPosted Apr 11, 2018, 1:28 AM EDT
mari muthuRank #8,962 · 213 reputationPosted Apr 11, 2018, 1:46 AM EDT
Manav PandyaRank #166 · 14.3K reputationPosted Apr 11, 2018, 1:49 AM EDT