- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Client Checking file size using HTML5
Before HTML5, the file size was checked with flash but now flash is avoided in web apps. Still the file size on the client side can be checked by inserting the below given code inside an event listener.
if (typeofFileReader !== "undefined") { // file[0] is file 1 var s = document.getElementById('myfile').files[0].size; }
On file input change, the size will update. For that, use event listener,
document.getElementById('input').onchange = function() { // file[0] is file 1 var s = document.getElementById('input').files[0].size; alert(s); }
Advertisements