javascript自动上传或从本地目录读取文件

javascript自动上传或从本地目录读取文件,javascript,google-chrome,file-upload,filereader,local-files,Javascript,Google Chrome,File Upload,Filereader,Local Files,我试图读取本地文件。我有一个MSIE的解决方案。 但chorme和firefox对此类操作的限制更大一些 所以我尝试使用FileReader,但似乎无法从本地目录中读取 经过一些测试,我有了这个想法。 我想在没有任何对话框的情况下“自动上传”文件 <!doctype html> <html> <script> function handle_files(files) { for (i = 0; i < files.length; i++) {

我试图读取本地文件。我有一个MSIE的解决方案。 但chorme和firefox对此类操作的限制更大一些

所以我尝试使用FileReader,但似乎无法从本地目录中读取

经过一些测试,我有了这个想法。 我想在没有任何对话框的情况下“自动上传”文件

<!doctype html>
<html>
<script>
function handle_files(files) {
  for (i = 0; i < files.length; i++) {
    file = files[i]
    console.log(file)
    var reader = new FileReader()
    reader.onload = function(e) {
      console.log(e.target.result)
    }
    reader.onerror = function(stuff) {
      console.log("error", stuff)
      console.log (stuff.getMessage())
    }
    reader.readAsText(file) //readAsdataURL
  }

}

handle_files(document.getElementById("input").value);
</script>
<body>
FileReader that works!
<input type="file" multiple onmouseover="handle_files(this.files)" id="input" value="K:\\somewhere\\over\\the\\rainbow\\c_comments.txt">
</body>
</html>

函数句柄_文件(文件){
对于(i=0;i
我现在的问题是:如何管理一个很好的上传? 也许有人有个好主意。 谢谢

马库斯