show a browse folder dialog to select all files in a specified directory recursively in JavaScript

I think I can get the folder name from the browse folder dialog. But I can't do that because of a security reason. So how can I get the folder name. You can create the folder's tar file by 7z command. Then fire the browse folder dialog. Now, you can get the folder's tar file name from the input element.

<html>
<head>
<title>show a browse folder dialog to select all files in a specified directory recursively in JavaScript</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
</head>
<body style="background:lightgray">
<p>Click the button to test:</p>
<input type="file" id="fileUpload" directory webkitdirectory multiple>
</br>
<textarea id="edit" style="height:200px;width:240px">
 Click the select file button to select files, then show the select file names.
</textarea>
<script>
$('input[type=file]').change(function () {
  var text="";
  for(var i=0;i<this.files.length;i++){
  text+=this.files[i].name+"\n";
  }
  $('#edit').val(text)
  })
</script>
</body>
</html>

Comments

Popular posts from this blog

Format date as yyyy-mm-dd using vbscript

How to write data into a excel file using vbscript

android adb command usage