/ Published in: jQuery
Find file size in clinet side
Expand |
Embed | Plain Text
<input type="file" id="loadfile" /> <input type="button" value="find size" onclick="findSize()" /> <script type="text/javascript"> function findSize() { var fileInput = $("#loadfile")[0]; byteSize = fileInput.files[0].fileSize; var suffix = 'KB'; if (byteSize > 1000) { byteSize = Math.round(byteSize *.001 * 100) * .01; suffix = 'MB'; } alert( byteSize + '-' + suffix); // Size returned in bytes. } </script>
You need to login to post a comment.
