I want to limit the maximum upload of image files by adding alerts to the following code
the alert is alert("You Have Reached The MAXIMUM Upload Limit");
so when I add one by one to the specified limit, an alert will appear
<div class="files col-sm-4" id="files1">
    <input type="file" name="files1" id="imagesix" multiple />
    <br />Selected files:
    <ol class="fileList"></ol>
</div>
script
$.fn.fileUploader = function (filesToUpload) {
    this.closest(".files").change(function (evt) {
        for (var i = 0; i < evt.target.files.length; i++) {
            filesToUpload.push(evt.target.files[i]);
        };
        var output = [];
        for (var i = 0, f; f = evt.target.files[i]; i++) {
            var removeLink = "<i class=\"fa fa-times fa-close removeFile\" href=\"#\" data-fileid=\"" + i + "\"></i>";
            output.push("<li><strong>", escape(f.name), "</strong> ", removeLink, " </li> ");
        }
        $(this).children(".fileList")
            .append(output.join(""));
    });
};
var filesToUpload = [];
$(document).on("click",".removeFile", function(e){
    e.preventDefault();
    var fileName = $(this).parent().children("strong").text();
    for(i = 0; i < filesToUpload.length; ++ i){
        if(filesToUpload[i].name == fileName){
            filesToUpload.splice(i, 1);
        }   
    }
    $(this).parent().remove();
});
$("#files1").fileUploader(filesToUpload);