0

I'm using jansy bootstrap to replace the asp.net FileUpload. I've successfully retrieved the file using HttpPostedFile with the help of this answer:

HttpPostedFile image = Request.Files["myFile"];

Now, how do I allow multiple files to be selected? With the asp.net FileUpload it was simply adding AllowMultiple="True" parameter and then in the code behind I simply looped through:

foreach (var image in FileUpload1.PostedFiles)
{...}

How do I do this with a custom control? THis is my current html (which is the first Image Upload Widget example):

<div class="fileinput fileinput-new" data-provides="fileinput">
    <div class="fileinput-preview thumbnail" data-trigger="fileinput" style="width: 200px; height: 150px;"></div>
    <div>
        <span class="btn btn-default btn-file"><span class="fileinput-new">Select image</span><span class="fileinput-exists">Change</span>
          <input type="file" id="myFile" name="myFile"></span>
        <a href="#" class="btn btn-default fileinput-exists" data-dismiss="fileinput">Remove</a>
    </div>
</div>
Community
  • 1
  • 1
benscabbia
  • 17,592
  • 13
  • 51
  • 62

1 Answers1

0

You can add multiple attribute and set its value to multiple to allow select of multiple files

<input type="file" id="myFile" name="myFile" multiple="multiple">
Mairaj Ahmad
  • 14,434
  • 2
  • 26
  • 40
  • thank you for your help! I did think it may have just been an extra parameter. I now have another minor problem with the display of multiple images, would you mind [taking a look](http://stackoverflow.com/questions/34435976/jansy-bootstrap-file-upload-doesnt-show-multiple-files)? Thanks again! – benscabbia Dec 23 '15 at 12:45