0

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.

diyoda_
  • 5,274
  • 8
  • 57
  • 89
  • FileUpload is server control of asp.net webforms. It is not about asp.net mvc. Are you sure that you use right tag? – Kirill Bestemyanov Sep 05 '12 at 13:58
  • Well I have seen of these in some tutorials as well. And the view is giving exactly what I was expecting. But its not submitting. – diyoda_ Sep 06 '12 at 02:37

1 Answers1

1

I have not included the enctype = "multipart/form-data" inside the Html.BeginForm So that the value is not taken to the file input. Now it ok. This will give you a good explanation.

Community
  • 1
  • 1
diyoda_
  • 5,274
  • 8
  • 57
  • 89