I have a form with multiple fields and alongwith the data user is submitting number of documents. For one file in the form there is a solution to check the file size but how do i go about it when there are more than one files in my form.
For one file the check is as follows:
$('#file_check').on('change', function() {
console.log('This file size is: ' + (this.files[0].size/1024/1024).toFixed(2) + " MB");
});
The html for my files is:
<form action="upload.php" method="post" multipart="" enctype="multipart/form-data">
<input class="form-control" type="text" placeholder="Name" name="name" id="name" required>
<input type="file" id="file_check" name="img[]" class="doc_upload" multiple>
<input type="file" id="file_check" name="img[]" class="doc_upload" multiple>
<input type="file" id="file_check" name="img[]" class="doc_upload" multiple>
</form>