Display number of selected files in upload form - Javascript jQuery

Javascript examples for jQuery:Form Number Field

Description

Display number of selected files in upload form

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <script type="text/javascript" src="https://code.jquery.com/jquery-1.9.1.js"></script> 
  <script type="text/javascript">
    $(window).load(function(){/*from   w w  w .  j  ava  2 s.co m*/
$(':file').change(function () {
    $('#numberOfFiles').text(this.files.length + " file selected");
});
    });

      </script> 
 </head> 
 <body> 
  <input type="file" name="files" multiple> 
  <p id="numberOfFiles"></p>  
 </body>
</html>

Related Tutorials