I want to select multiple images but max 5 images and after 5 images when user click on 6th images then the user not allowed to select more than 5 images.
Below what I am doing:
<input class="form-control" type="file" name="photo[]" id="photo" multiple max-uploads = "5" >
<script>
$(function(){
$("input[type = 'submit']").click(function(){
var $fileUpload = $("input[type='file']");
if (parseInt($fileUpload.get(0).files.length) > 5){
alert("You are only allowed to upload a maximum of 5 files");
}
});
});
</script>
In this case I need to click submit button. I want when user select the image and if image more than 5 then user not able to select the 6th image.
I want to SET the select limit.
Kindly suggest me what I am doing wrong. Your valuble suggestions would be welcome.