How to use @FileUpload.GetHtml inside Html.BeginForm and sumbit FilesList
        Posted  
        
            by 
                Diode
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Diode
        
        
        
        Published on 2012-09-05T13:48:49Z
        Indexed on 
            2012/09/06
            3:38 UTC
        
        
        Read the original article
        Hit count: 693
        
asp.net-mvc-3
|Razor
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.
© Stack Overflow or respective owner