On change of the input track how many files are selected:
$("#image").on("change", function() {_x000D_
if ($("#image")[0].files.length > 2) {_x000D_
alert("You can select only 2 images");_x000D_
} else {_x000D_
$("#imageUploadForm").submit();_x000D_
}_x000D_
});
_x000D_
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>_x000D_
<strong>On change of the input track how many files are selected:</strong>_x000D_
<input name="image[]" id="image" type="file" multiple="multiple" accept="image/jpg, image/jpeg" >
_x000D_