Get the contents of the directory from local PC in javascript - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:each

Description

Get the contents of the directory from local PC in javascript

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.8.3.js"></script> 
  <script type="text/javascript">
    $(window).load(function(){//from  w ww . j a va  2  s .  c o m
document.querySelector("input").onchange = function() {
    [].slice.call( this.files ).forEach( function(v) {
          $("body").append("<div>"+v.name+"</div>" );
    });
};
    });

      </script> 
 </head> 
 <body> 
  <input type="file" webkitdirectory>  
 </body>
</html>

Related Tutorials