Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
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
