Getting File size in JavaScript
In this blog you will learn that how you can get size of file in JavaScript so that you can validate it as per your choice -
Step 1- This is our HTML of the program
<h2>Choose file to check the size</h2>
<input type="file" id="header-image" >
Step 2 - This is the JavaScript of the program
var file = document.getElementById("header-image"); file.addEventListener('change', function () { var image = this.files[0]; alert(image.size/1024+"kb"); });
Output -
0 Comments
Please do not enter any spam link in comment box.