Take the 2-minute tour ×

Javascipt can get file size (size in bytes)?

I need before uploading image, understand what is image size, its possible ?

share|improve this question
Duplicate: stackoverflow.com/questions/2966076/… –  ATOzTOA Jan 12 '13 at 11:02
Also check stackoverflow.com/questions/4112575/… –  danronmoon Jan 12 '13 at 11:03

1 Answer 1

Get a handle to the <input type="file"> element, then:

var file = fileinput.files && fileinput.files[0];
if( file ) {
     console.log( file.size, file.type );
else if( !("files" in fileInput)) {
    // not supported
else {
    //No file selected
share|improve this answer

Your Answer


