Please use this function on submit form
<button onclick="store()" type="button">form submit</button>
function store(){
var totalsize = 0; // total post data size
$('form').find('input[type=file]').each(function() { // for all files in form
totalsize += this.files[0].size;
});
totalsize=totalsize+($("form").not("[type='file']").serialize().length);
if (totalsize > (6 * 1048576)) { // > 6MB
// this will exceed post_max_size PHP setting, now handle...
alert('this will exceed post_max_size PHP setting')
} else if ($('form').find('input[type=file]').length >= 10) { // max_file_upload_limit = 10;
// if file upload is more than 10
alert('upload is more than 10 files')
}else{
you are free upload data successfully
}
}