File size and file type finding in js(javascript)
< script src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js" > </ script > < form action = "upload.php" enctype = "multipart/form-data" method = "POST" id = "uploadform" > < input id = "openFile" name = "img" type = "file" /> </ form > <script> $( document ).ready( function ( ) { $( '#openFile' ).on( 'change' , function ( evt ) { console .log( this .files[ 0 ].size); ///File size var filename= this .files[ 0 ]; extension = filename.split( '/' ).pop(); // File Type Extension }); }); </script> ------------------------------------------------------------------------------- <form id="form1" runat="server"> <input type='file' id="imgInp" /> <img id="blah" src="#" alt="your image...