0

I am trying to set a max limit on an input of files when uploading files to a blob container. The code below allows for multiple selections of files and I want to limit it to a maximum of 5 is that possible ?

<input multiple type="file" name="files" id="files" required />

1 Answers1

1

Use Jquery:

$(function(){
    $("input[type='submit']").click(function(){
        var $fileUpload = $("input[type='file']");
        if (parseInt($fileUpload.get(0).files.length)>2){
         alert("You can only upload a maximum of 2 files");
        }
    });    
});​

How to limit the maximum files chosen when using multiple file input

MD. RAKIB HASAN
  • 3,670
  • 4
  • 22
  • 35