Answers for "bootstrap 3 file input set filename"

0

bootstrap input file

<div class="custom-file">
 <input type="file"  class="custom-file-input" id="inputGroupFile01">
<label class="custom-file-label" for="inputGroupFile01">Choose file</label>
</div>
Posted by: Guest on April-25-2021
0

bootstrap get filename from file input multiple

$(document).ready(function() {
  $('input[type="file"]').on("change", function() {
    let filenames = [];
    let files = document.getElementById("customFile").files;
    if (files.length > 1) {
      filenames.push("Total Files (" + files.length + ")");
    } else {
      for (let i in files) {
        if (files.hasOwnProperty(i)) {
          filenames.push(files[i].name);
        }
      }
    }
    $(this)
      .next(".custom-file-label")
      .html(filenames.join(","));
  });
});
Posted by: Guest on November-04-2020

Browse Popular Code Answers by Language