Issue Check size from input
hi all i m a beginner and i have a trouble, i'd like check multiple files size from input file and if it's too big do an alert.
I'm too bad, i don't know why that doesn't work :'(. If you could help a dumie ^^.
Check my input files with id "inputcontrol" and alert.
But nothing append!!!
Max Size 2000
Thks Guys :-)
Below my html :
- <span class="btn btn-primary" id="browse">
- Browse… <input type="file" style="display:none;" multiple id="inputcontrol" name="userfile[]">
- </span>
Below my Jquery:
- $('input[type="file"]').change(function(){
- var imageSizeArr = 0;
- var imageSize = document.getElementById('inputcontrol');
- var imageCount = imageSize.files.length;
- for (var i = 0; i < imageSize.files.length; i++)
- {
- var imageSize = imageSize.files[i].size;
- if (imageSize > 2000) {
- var imageSizeArr = 1;
- }
- if (imageSizeArr == 1)
- {
- alert("too big");
- }
- else if (imageSizeArr == 0)
- {
- alert("not too big");
- }
- }
- });