HTML:
js获取上传文件的大小: <input id="uploadFile" type="file" name="myPhoto"/> <button id="btnConfirm" class="btn" onclick="checkFile()">确认上传</button>
JS:
<script> function checkFile() { //获取文件 var file = document.getElementById("uploadFile").files[0]; var vv=file.size;//文件的字节数 alert(vv) }; </script>
The above is the detailed content of How to get the size of uploaded file using js. For more information, please follow other related articles on the PHP Chinese website!