How to use @FileUpload.GetHtml inside Html.BeginForm and sumbit FilesList
- by Diode
There is a default submit button for the @FileUpload.GetHtml. But I am expecting to have a submit button inside the Html begin form and use that substitution to submit the list of files with some more parameters. But when I do that the passing IEnumerable is always null in the Action method.
This is my Action method:
[HttpPost]
public ActionResult Change(IEnumerable filesList, Guid ID, string Btn)
{....
@using (Html.BeginForm("Change", "Home",FormMethod.Post))
{
<textarea id="textArea" name="epost2" class="frm_txtfield_big" style="float:left; width:638px; height:200px;"></textarea>
<input type="hidden" name="supportID" value="@Model.ID" />
@FileUpload.GetHtml(name: "ChooseFile",initialNumberOfFiles: 1,allowMoreFilesToBeAdded: true,includeFormTag: false)
.......}
But this is not passing the list of files to the method.
Am doing it wrong or what is the wrong with the code.