Bootstrap File Input with Asp.net MVC

Asked

Viewed 382 times

0

I am using Bootstrap File Input (http://plugins.krajee.com/file-advanced-usage-demo) in my Asp.Net MVC project but it has a bug that when I add some file and then add another one it keeps showing on the screen all but only post the last added files. Someone has already been through this and managed to solve ? The most I got was the $("#File") method. fileinput('getFileStack') which returns an array of files but I am also unable to post this array to the server. I am waiting. Thank you.

Below follows the section of the View where the upload is.

@using (Html.BeginForm("Create", "ContaPagar", FormMethod.Post, new { @enctype = "multipart/form-data" }))
            {
                <div class="col-md-12 form-group">
                    @Html.TextBoxFor(x => x.File, new { type = "file", multiple = "true", @accept = "application/pdf", @class= "file", @id= "File", Name = "File" })
                    <br>
                </div>

                <div class="col-md-3 pull-right form-group">
                    <div class="btn-group">
                        <button id="btnSalvar" name="btnSalvar" type="submit" class="btn btn-success">Salvar Pagamento</button>
                    </div>
                </div>                
                }

And on the server I pick up the files through the Request.Files. The problem is that when I add files and add others later (e.g., I add 2 .pdf and then 3 .pdf totaling 3) it only posts the last ones added.

  • 2

    the ideal would be you post the codes you have, De View, model and controller, to facilitate the identification of the error

  • The problem could be how you’re retrieving the information, post your controller and its view without it becomes difficult to define an answer

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.